Android RecyclerView below Toolbar
If Adding a scrolling behavior does not fix your issue
app:layout_behavior="@string/appbar_scrolling_view_behavior"
THEN TRY THIS
I had to give padding to recyclerview which is equivalent to the toolbar/actionbar(app bar) height.
android:paddingTop="?attr/actionBarSize"
add the above line to the recyclerview xml file
Try this:
<?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:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
I have removed the ViewPager and added scrolling behavior to RecyclerView
When I have included RecyclerView from another layout the same problem occurred. I added this following line on recyclerview and the problem no longer persists.
app:layout_behavior="@string/appbar_scrolling_view_behavior"
Missing this above line will make this problem.