In my android application I have to show one linear layout and a RecyclerView below the linear layout, when the user reaches the bottom of the RecyclerView by scrolling I have to hide the LinearLayout with a parallax effect. I am not prefer to use any third party libraries and dependencies. I have to use android design library only. I think, using coordinate layout can do this.
xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/dimen_sm"
android:paddingLeft="@dimen/dimen_sm"
android:paddingRight="@dimen/dimen_sm"
android:paddingTop="@dimen/dimen_sm"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/top_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:paddingBottom="@dimen/dimen_sm"
android:paddingTop="@dimen/dimen_sm"
app:layout_collapseMode="parallax">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
app:layout_scrollFlags="pin"
android:id="@+id/recycler_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dimen_xs"/>
</LinearLayout>
can any one help me to do this ?
UPDATE
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:paddingBottom="@dimen/dimen_sm"
android:paddingLeft="@dimen/dimen_sm"
android:paddingRight="@dimen/dimen_sm"
android:paddingTop="@dimen/dimen_sm"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:id="@+id/top_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:paddingBottom="@dimen/dimen_sm"
android:paddingTop="@dimen/dimen_sm"
app:layout_collapseMode="parallax">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dimen_xs" />
</android.support.v4.widget.NestedScrollView>
`
<!--<android.support.v7.widget.RecyclerView
app:layout_collapseMode="pin"
android:id="@+id/recycler_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dimen_xs"
android:background="@color/white" />-->
</android.support.design.widget.CoordinatorLayout>
I have changed my code to this. now the paralax is working, but the recyclerView is not coming