0

The effect Im after is that that views inside the nestedscrollview should scroll to the top of the screen removing the toolbar with "scroll|enterAlways" Once that occurs the recycleview should become scrollable.

Currently the recycleview scrollers with out removing the toolbar.

Any ideas on how I could sort this?

This is what I have so far...

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">



    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:contentInsetStart="0dp"
            android:contentInsetLeft="0dp"
            app:contentInsetLeft="0dp"
            app:contentInsetStart="0dp"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways">    
        </android.support.v7.widget.Toolbar>

    </android.support.design.widget.AppBarLayout>








    <android.support.v4.widget.NestedScrollView
        android:background="@android:color/holo_blue_light"
        android:id="@+id/scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_vertical"
        android:fitsSystemWindows="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:fitsSystemWindows="true"
            android:orientation="vertical"
            android:padding="10dp"
            android:background="@android:color/white"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/searchDisplay">
            <TextView
                android:text="Possible Artists:"
                android:textStyle="bold"
                android:textColor="@android:color/holo_green_dark"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />


            <android.support.v7.widget.RecyclerView
                android:fitsSystemWindows="true"
                android:background="@android:color/holo_green_light"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                android:id="@+id/recyclevertscroller"
                android:scrollbars="vertical"
                android:layout_width="match_parent"
                android:layout_height="500dp"/>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>


</android.support.design.widget.CoordinatorLayout>
aidanmack
  • 518
  • 1
  • 5
  • 16
  • 1
    Basically a RecyclerView with a header, if I understand this correctly. Use a custom RecyclerView Adapter where the first position is always just a TextView saying "Possible Artists:". Remove the NestedScrollView. – Eugen Pechanec Aug 31 '15 at 18:40
  • Must be better away. You might at some point have image views and text views above it. If the user goes straight for the recycleview they aint goner get the coordinator views effect. – aidanmack Aug 31 '15 at 20:55
  • 2
    You can only listen for scrolling of one view - either NestedScrollView or RecyclerView. RecyclerView inside a ScrollView is the same abomination as a ListView inside a ScrollView, it just doesn't work as intended. If you can do without view recycling use NestedScrollView only. If you need view recycling add headers (custom view types) in the RecyclerView adapter. – Eugen Pechanec Aug 31 '15 at 21:06

0 Answers0