Reputation: 1397
Question in a nut shell:
How can i attach a scroll behavior to a RecyclerView which isn't a direct child of CoordinatorLayout?
<CoordinatorLayout id="root">
<AppBarLayout>
<Toolbar/>
</AppBarLayout>
<FrameLayout id ="fragment_container">
<RecyclerView id="list" behavior="..."/>
</FrameLayout>
</CoordinatorLayout>
Why i want this?
I have one activity which holds the toolbar and has a main slot for content like a list of "Foo". The list is encapsulated in a Fragment which contains a FrameLayout with a RecyclerView, empty State TextView and a ProgressView. The problem is that the first row in my RecyclerView is behind the toolbar.
Upvotes: 1
Views: 1306
Reputation: 3845
Try to replace your FrameLayout with NestedScrollView
<android.support.v4.widget.NestedScrollView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
or make this as parent view of your FrameLayout
It work for me
Upvotes: 0