I want to build an android fragment with this layout:
When the bottom RecyclerView is scrolled toward its bottom, I want the top one to collapse and hide (and open when the bottom view is scrolled to the top).
A coordinator layout would seem to be the answer, but every example I come across uses an AppBarLayout for the top section. The activity containing the fragment already has an app bar displayed; I don't want to modify it.
How would I implement this two RecyclerView setup in a CoordinatorLayout without addressing the app bar?
You can use a NestedScrollView
, a LinearLayout
with vertical orientation as child of of NestedScrollView
and add both RecyclerView
s as children of LinearLayout
sample
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>