title: AppBarLayout Scroll Behavior
body: <p>I am using the design support library to build a material viewpager. The code for the xml file is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;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"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/appBarLayout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
          &lt;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"
              app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@+id/tabLayout"
              style="@style/TabLayoutStyle"
              android:layout_width="match_parent"
              android:layout_height="wrap_content" /&gt;
  
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/viewpager"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>One of the fragments on the viewpager has a recycler view inside a relative layout. The code is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/layout"
      android:layout_width="match_parent"
      android:padding="2.5dip"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;ProgressBar
          android:id="@+id/progressBar"
          style="?android:attr/progressBarStyleLarge"
          android:layout_width="50dip"
          android:layout_height="50dip"
          android:layout_centerInParent="true"
          android:layout_margin="20dip"
          android:indeterminate="false" /&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/recyclerView"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:scrollbars="none"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"
          android:visibility="gone" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The result i want is when the recyclerview scrolls, the toolbar should scroll away from view leaving the tablayout only, but what i have is on scroll, the tablayout scrolls out of view leaving the toolbar. </p>
  
  <p>How can i achieve this? </p>