title: Android collapsing toolbar like Google play games app
body: <p>I'm trying to add a collapsing toolbar in my application like Google play games application. Please help me to implement this.</p>
  
  <p>Here is my layout code:</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/htab_maincontent"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fitsSystemWindows="true"&gt;
  
  &lt;android.support.design.widget.AppBarLayout
      android:id="@+id/htab_appbar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="?attr/colorPrimary"
      android:fitsSystemWindows="true"
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
      &lt;android.support.design.widget.CollapsingToolbarLayout
          android:id="@+id/htab_collapse_toolbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:fitsSystemWindows="true"
          app:contentScrim="?attr/colorPrimary"
          app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
          app:titleEnabled="false"&gt;
  
          &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:fitsSystemWindows="true"
              app:layout_collapseMode="parallax"&gt;
              &lt;include
                  layout="@layout/layout_header"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"/&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/htab_toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:layout_gravity="top"
              android:layout_marginBottom="48dp"
              app:layout_collapseMode="pin"
              app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@+id/htab_tabs"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="bottom"
              app:tabIndicatorColor="@android:color/black"
              app:tabSelectedTextColor="@android:color/black"
              app:tabTextColor="@android:color/black"
              android:background="@android:color/white"/&gt;
  
      &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
  
  &lt;/android.support.design.widget.AppBarLayout&gt;
  
  &lt;android.support.v4.view.ViewPager
      android:id="@+id/htab_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>Here is the link for model: 
  <a href="https://drive.google.com/file/d/0B96q57CU3elESmpsUFFBcHZaRzA/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/0B96q57CU3elESmpsUFFBcHZaRzA/view?usp=sharing</a></p>
  
  <p>Link for app:
  <a href="https://play.google.com/store/apps/details?id=com.google.android.play.games" rel="nofollow noreferrer">https://play.google.com/store/apps/details?id=com.google.android.play.games</a></p>