I'm trying to obtain this effect where if the user scroll a RecyclerView
a certain layout scroll up together with the recycler and disappear behind a Toolbar
.
A similar behavior could be obtained using the CoordinatorLayout
, this would be possible by setting
app:layout_behavior="@string/appbar_scrolling_view_behavior"
on the said Recycler, and doing
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"/>
</android.support.design.widget.AppBarLayout>
Also, If I put a second child inside the AppBarLayout
, and set app:layout_scrollFlags
to it, the effect obtained is the same, with both layout scrolling together with the Recycler.
What I'm trying to achieve is to keep the first child (The toolbar) fixed in position, and let the second child (a LinearLayout
) to scroll and hide behind the toolbar. Unfortunately I couldn't get to this behavior.
Is it possible without using 3rd part library? Thanks in advance and sorry for my english.