title: How to hide the Actionbar like they do in Whatsapp?
body: <p>I have a fragment with following layout, to which I am adding two fragments with help of a view pager:</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:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  &lt;android.support.design.widget.AppBarLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
  
  &lt;android.support.design.widget.TabLayout
      android:id="@+id/tab_layout"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
  
      android:background="#2096f3"
      android:elevation="6dp"
      android:minHeight="?attr/actionBarSize"
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/&gt;
  &lt;/android.support.design.widget.AppBarLayout&gt;
  &lt;android.support.v4.view.ViewPager
      android:id="@+id/pager"
      android:layout_width="match_parent"
      android:layout_height="fill_parent"
      android:layout_below="@id/tab_layout"
      /&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>And in the code:</p>
  
  <pre><code>    TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.tab_layout);
      tabLayout.addTab(tabLayout.newTab().setText(tabs[0]));
      tabLayout.addTab(tabLayout.newTab().setText(tabs[1]));
      tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
  
      viewPager = (ViewPager) rootView.findViewById(R.id.pager);
  
      adapter = new MyViewPagerAdapter(getFragmentManager(),2);
      viewPager.setAdapter(adapter);
  </code></pre>
  
  <p>I have a scrollview in the fragments in the view pager. I want the action-bar to hide when I start to scrolldown. How to achieve this?</p>
  
  <p>I have a toolbar in the activity to which I am adding few fragments. How can I tweak it get the expected result:</p>
  
  <p>Toolbar:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.Toolbar     xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:background="@color/background_floating_material_dark"
  android:elevation="4dp"
  android:paddingTop="1dp"
  app:layout_scrollFlags="scroll|enterAlways"&gt;
  </code></pre>
  
  <p></p>