title: Hiding/Showing the toolbar when fragment in the tabs is scrolled
body: <p>I added the new <code>Toolbar</code>, <code>Tablayout</code> and <code>Viewpager</code> in my android app. I provided Fragments for my 3 Tabs and its working fine. But the problem is that when i scroll up my Toolbar does not hide. I want that when i scroll my fragment it should hide. And one more thing, i am using Webview in the fragment. 
  My codes are given below.</p>
  
  <p><strong>MainActivity.Java</strong></p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      TabLayout tabLayout;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
          setupToolbar();
          setupTablayout();
      }
  
  private void setupToolbar() {
      // TODO Auto-generated method stub
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarsdfs);
      if (toolbar != null) {
          setSupportActionBar(toolbar);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);}
  }
  
  private void setupTablayout() {
      // TODO Auto-generated method stub
      tabLayout = (TabLayout) findViewById(R.id.tabLayout);
      tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
      tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
      tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
      final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
      final PagerAdapter adapter = new PagerAdapter
              (getSupportFragmentManager(), tabLayout.getTabCount());
      viewPager.setAdapter(adapter);
      viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
      tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
          @Override
          public void onTabSelected(TabLayout.Tab tab) {
              viewPager.setCurrentItem(tab.getPosition());
          }
  
          @Override
          public void onTabUnselected(TabLayout.Tab tab) {
  
          }
  
          @Override
          public void onTabReselected(TabLayout.Tab tab) {
  
          }
      });
  }
  }
  </code></pre>
  
  <p><strong>main.xml</strong></p>
  
  <pre><code>&lt;android.support.design.widget.CoordinatorLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/coordinatorLayout"
      android:layout_height="match_parent"
      android:layout_width="match_parent"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/appbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
  &lt;android.support.v7.widget.Toolbar
      android:id="@+id/toolbarsdfs"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:minHeight="?attr/actionBarSize"
      android:background="?attr/colorPrimaryDark"
      android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
      app:layout_scrollFlags="scroll|enterAlways"/&gt;
  
  &lt;android.support.design.widget.TabLayout
              android:id="@+id/tabLayout"
              android:scrollbars="horizontal"
              android:layout_below="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:background="?attr/colorPrimary" /&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/tablayout"/&gt;
  
  &lt;/android.support.design.widget.AppBarLayout&gt;
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p><strong>PagerAdapter.Java</strong></p>
  
  <pre><code>public class PagerAdapter extends FragmentStatePagerAdapter {
      int mNumOfTabs;
  
      public PagerAdapter(FragmentManager fm, int NumOfTabs) {
          super(fm);
          this.mNumOfTabs = NumOfTabs;
      }
  
      @Override
      public Fragment getItem(int position) {
  
          switch (position) {
              case 0:
                  Fragment_Feeds tab1 = new Fragment_Feeds();
                  return tab1;
              case 1:
                  Fragment_Facts tab2 = new Fragment_Facts();
                  return tab2;
              default:
                  return null;
          }
      }
  
      @Override
      public int getCount() {
          return mNumOfTabs;
      }
  }
  </code></pre>
  
  <p><strong>Fragment_Feeds.java</strong></p>
  
  <pre><code>public class Fragment_Feeds extends Fragment {
      SwipeRefreshLayout swipeView;
      WebView myWebView;
      ProgressBar progressBar;
      final static String myBlogAddr = "http://myblog.com";
      String myUrl;
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragmentfeeds, container, false);
          swipeView = (SwipeRefreshLayout) view.findViewById(R.id.swipe);
  
          myWebView = (WebView) view.findViewById(R.id.webview);
          progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
          myWebView.setWebViewClient(new MyWebViewClient()); 
          WebSettings webSettings = myWebView.getSettings();
          webSettings.setJavaScriptEnabled(true);
          myWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
          myWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
          myWebView.setHorizontalScrollBarEnabled(false);
          myWebView.loadUrl("http://myblog.com");
          swipeView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()    
          {
              @Override
              public void onRefresh() 
              {
                    myWebView.loadUrl("http://myblog.com");
  
              }});
          return view;
      }
      private class MyWebViewClient extends WebViewClient {
          @Override
          public void onPageFinished(WebView view, String url) {
              swipeView.setRefreshing(false);
          }
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
           myUrl = url;
              view.loadUrl(url);
              return true;
          }
          @Override
          public void onReceivedError(WebView view, int errorCod,String description, String failingUrl) {
              myWebView.loadUrl("file:///android_asset/error_page.html");
          }
      }
      @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          inflater.inflate(R.menu.main, menu);
          super.onCreateOptionsMenu(menu, inflater);
      }
  }
  </code></pre>
  
  <p><strong>fragmentfeeds.xml</strong></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:background="#FFFFFF" &gt;
      &lt;ProgressBar
          android:id="@+id/progressBar"
          style="?android:attr/progressBarStyleSmall"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
      &lt;android.support.v4.widget.SwipeRefreshLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/swipe"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FFFFFF"&gt;s
  
      &lt;WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:numColumns="1"
        android:scrollbars="none"
        android:focusableInTouchMode="false"
        android:focusable="false"
        android:background="#FFFFFF" /&gt;
     &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>What i want?</strong></p>
  
  <p>What i want is that when i scroll the webview upwards, the toolbar should also scroll upwards and hides and when i scroll back down the toolbar should come back as soon as possible.</p>