title: Programmatically hide / show android support design TabLayout inside AppBarLayout
body: <p>I want to programmatically hide / show the <code>TabLayout</code> in my <code>AppBarLayout</code>. Simply setting visibility to <code>VISIBLE</code> and <code>GONE</code> is not enough, as I want to animate the changes and reclaim the space with my content while the tab retreats and leave the space once the tab is shown back.</p>
  
  <p>Below is the relevant part of my layout XML - </p>
  
  <pre><code>    &lt;android.support.design.widget.AppBarLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:background="@color/colorPrimary"
              app:layout_scrollFlags="scroll|enterAlways"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
              app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@android:id/tabs"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              app:layout_scrollFlags="scroll|enterAlways"
              app:tabMode="scrollable"
              android:layout_marginStart="42dp"
              android:layout_marginLeft="42dp"
              style="@style/MainTabLayout"&gt;
  
          &lt;/android.support.design.widget.TabLayout&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
  </code></pre>