title: how can I add the viewpager and tablayout under the collapsing toolbar layout
body: <p>I tried all solution for this problem in <code>stackoverflow</code> but I got nothing helpful . 
  First of all , I  want to achieve layout like this or similar to it :</p>
  
  <p><a href="https://i.stack.imgur.com/wVUCL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wVUCL.jpg" alt="enter image description here"></a></p>
  
  <p>And according to  some question in <code>stackoverflow</code> like <a href="https://stackoverflow.com/questions/36000670/collapsingtoolbarlayout-with-tablayout-and-viewpager">this</a>
  I'm able to achieve  this layout :</p>
  
  <p><a href="https://i.stack.imgur.com/PCJd4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PCJd4.png" alt="enter image description here"></a></p>
  
  <p>with this xml file :</p>
  
  <pre><code>&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/main_content"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/MyAppbar"
          android:layout_width="match_parent"
          android:layout_height="256dp"
          android:fitsSystemWindows="true"&gt;
  
          &lt;android.support.design.widget.CollapsingToolbarLayout
              android:id="@+id/collapse_toolbar"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@android:color/transparent"
              android:fitsSystemWindows="true"
              app:contentScrim="?attr/colorPrimary"
              app:layout_scrollFlags="scroll|exitUntilCollapsed"&gt;
  
              &lt;ImageView
                  android:id="@+id/bgheader"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="@drawable/aks"
                  android:fitsSystemWindows="true"
                  android:scaleType="centerCrop"
                  app:layout_collapseMode="parallax" /&gt;
  
              &lt;android.support.v7.widget.Toolbar
                  android:id="@+id/MyToolbar"
                  android:layout_width="match_parent"
                  android:layout_height="?attr/actionBarSize"
                  android:theme="@style/ThemeOverlay.AppCompat.Dark"
                  app:layout_collapseMode="pin" /&gt;
  
              &lt;com.majid.whiteboard.utils.CustomTabLayout
                  android:id="@+id/tab_layout_detail_activity"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@color/colorPrimary"
                  app:paddingEnd="20dp"
                  app:paddingStart="20dp"
                  app:tabGravity="fill"
                  app:tabIndicatorColor="@color/silver"
                  app:tabIndicatorHeight="4dp"
                  app:tabMode="fixed"
                  app:tabSelectedTextColor="@color/grid_text_color"
                  app:tabTextColor="@color/grid_text_color" /&gt;
  
          &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/view_pager_detail_activity"
          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>Every thing is ok but now I have two problems :</p>
  
  <p><strong>1.Tablayout goes to the top of screen but I want to add this under the collapsing toolbar</strong></p>
  
  <p><strong>2.I can only collapse the toolbar only in the collapse area ( means only in pic and top of that)  and it's not working in other place on the screen .</strong></p>