title: CollapsingToolbarLayout not collapsing when using viewpager
body: <p>I have search all questions here related to my question but none helped so far. What I am trying to achieve is to have the middle toolbar collapse when the the fragment in the ViewPager is scrolled down and the TabLayout will just pin. Here's the structure of my main layout file. Nothing happens when I scroll down.</p>
  
  <p>Please help me. Any help would be greatly appreciated</p>
  
  <p>
  </p>
  
  <pre><code>&lt;android.support.design.widget.AppBarLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:theme="@style/AppTheme.AppBarOverlay"&gt;
  
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="?android:attr/actionBarSize"
          android:background="?attr/colorPrimary"
          app:popupTheme="@style/AppTheme.PopupOverlay" &gt;
      &lt;/android.support.v7.widget.Toolbar&gt;
  
      &lt;android.support.design.widget.CollapsingToolbarLayout
          android:layout_height="72dp"
          android:id="@+id/collapsing_toolbar"
          android:layout_width="match_parent"
          android:fitsSystemWindows="true"
          android:background="@color/colorPrimary"
          app:layout_scrollFlags="scroll|exitUntilCollapsed"
          app:popupTheme="@style/AppTheme.PopupOverlay"&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:fitsSystemWindows="true"
              app:layout_collapseMode="parallax"&gt;
  
              &lt;RelativeLayout android:id="@+id/relativeLayout"
                  android:layout_width="match_parent"
                  android:fitsSystemWindows="true"
                  android:layout_gravity="top"
                  android:paddingRight="20dp"
                  android:paddingLeft="20dp"
                  android:layout_height="wrap_content"&gt;
  
                  &lt;TextView android:id="@+id/tv_song_name"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:textColor="#FFFFFF"
                      android:layout_alignParentLeft="true"
                      android:textSize="20sp"
                      android:ellipsize="marquee"
                      android:singleLine="true"
                      android:text="Bloody Stream"/&gt;
                  &lt;TextView android:id="@+id/tv_artist"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentLeft="true"
                      android:layout_below="@+id/tv_song_name"
                      android:textSize="15sp"
                      android:fontFamily="Sans-serif-light"
                      android:textColor="#9E9E9E"
                      android:text="by Coda"/&gt;
              &lt;/RelativeLayout&gt;
  
          &lt;/android.support.v7.widget.Toolbar&gt;
  
      &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
  
      &lt;android.support.design.widget.TabLayout
          android:id="@+id/tabs"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@color/colorPrimary"
          android:layout_below="@+id/tool_bar"
          android:layout_gravity="center_horizontal"
          android:layout_alignParentStart="true"
          android:fitsSystemWindows="true"
          app:tabGravity="fill"
          app:tabMode="fixed"/&gt;
  &lt;/android.support.design.widget.AppBarLayout&gt;
  
  
  &lt;android.support.v4.view.ViewPager
      android:id="@+id/viewpager"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/&gt;
  
  
  &lt;android.support.design.widget.FloatingActionButton
      android:id="@+id/fab"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom|end"
      android:layout_margin="@dimen/fab_margin"
      android:src="@drawable/ic_file_download_white_24dp" /&gt;
  </code></pre>
  
  <p></p>