title: Disable expanding of AppBarLayout
body: <p>I have a Toolbar together with a TabLayout and an image wrapped inside a CollapsingToolbarLayout. This gif pretty much sums it up:</p>
  
  <p><a href="https://raw.githubusercontent.com/vitovalov/TabbedCoordinatorLayout/master/art/demo.gif" rel="noreferrer">https://raw.githubusercontent.com/vitovalov/TabbedCoordinatorLayout/master/art/demo.gif</a></p>
  
  <p>This is the XML:</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:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/appbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:fitsSystemWindows="true"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
          &lt;android.support.design.widget.CollapsingToolbarLayout
              android:id="@+id/collapse_toolbar"
              android:layout_width="match_parent"
              android:layout_height="250dp"
              android:fitsSystemWindows="true"
              app:contentScrim="?attr/colorPrimary"
              app:layout_scrollFlags="scroll|exitUntilCollapsed"&gt;
  
              &lt;ImageView
                  android:id="@+id/header"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="@drawable/photo"
                  android:fitsSystemWindows="true"
                  android:scaleType="centerCrop"
                  app:layout_collapseMode="parallax"/&gt;
  
              &lt;android.support.v7.widget.Toolbar
                  android:id="@+id/toolbar"
                  android:layout_width="match_parent"
                  android:layout_height="100dp"
                  android:gravity="top"
                  android:minHeight="?attr/actionBarSize"
                  app:layout_collapseMode="pin"
                  app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                  app:titleMarginTop="15dp"/&gt;
  
              &lt;android.support.design.widget.TabLayout
                  android:id="@+id/tabs"
                  android:layout_width="match_parent"
                  android:layout_height="?attr/actionBarSize"
                  android:layout_gravity="bottom"
                  app:tabIndicatorColor="@color/colorAccent"/&gt;
  
          &lt;/android.support.design.widget.CollapsingToolbarLayout&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>What I want to achieve is that for instance on Tab 2 I don't want to let the user be able to see the image. So even if he tries to pull the AppBarLayout down he should not see the image under any circumstance.</p>
  
  <p>Calling <code>appBarLayout.setExpanded(false);</code> upon showing Tab 2 does hide the image and collapse everything back. Though the moment you press on the AppBarLayout and swipe down you can get the image back. This should not be the case.</p>
  
  <p>How can I prevent this behavior?</p>
  
  <p>I'm using v23.1.1 of the support libraries. For version 22 of the libraryes there's already <a href="https://stackoverflow.com/questions/30779123/need-to-disable-expand-on-collapsingtoolbarlayout-for-certain-fragments">this question</a>. The workaround is however no longer applicable with version 23.</p>