title: Action bar is not hiding completely
body: <p>am tying to hide my action bar in runtime when i switch from tab2 to tab1 or tab3 but its leaving a blank space</p>
  
  <p>my Activity: (with a TabLayout and 3 fragments ) </p>
  
  <p><a href="https://i.stack.imgur.com/e3zMd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e3zMd.png" alt="enter image description here"></a></p>
  
  <p>switched to another tab , action bar is hidden now but there's a Blank space :</p>
  
  <p><a href="https://i.stack.imgur.com/55Yc9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/55Yc9.png" alt="enter image description here"></a></p>
  
  <p>am using <code>actionBar.hide</code> / <code>actionBar.show</code> ,  any clue how to properly remove this extra space ???  if what am trying to achieve is not possible then please guide me to any alternative way</p>
  
  <p>Codes:</p>
  
  <pre><code>ActionBar actionBar;
  ........
  ........
  actionBar = getSupportActionBar();
  ........
  ........
              @Override
              public void onTabSelected(TabLayout.Tab tab) {
                  viewPager.setCurrentItem(tab.getPosition());
  
                  if (tab == tab2){
                      actionBar.show();
  
  
                  }else {
                      actionBar.hide();
  
                  }};
  </code></pre>
  
  <p>Added Xml Codes:</p>
  
  <p>MainActivity which includes  <code>content_main</code></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"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context="MainActivity"
      android:animateLayoutChanges="true"&gt;
  
      &lt;include layout="@layout/content_main" /&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>content_main:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;RelativeLayout
  android:id="@+id/main_layout"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity"
      android:animateLayoutChanges="true"&gt;
  
  &lt;android.support.design.widget.TabLayout
      android:id="@+id/tabs"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="#e4e4e4"
      android:elevation="6dp"
      android:minHeight="?attr/actionBarSize"
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
      android:fillViewport="false"
      android:clickable="false" /&gt;
  
  &lt;android.support.v4.view.ViewPager
      android:id="@+id/viewpager"
      android:layout_width="match_parent"
      android:layout_height="fill_parent"
      android:layout_below="@id/tabs"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>