title: How to hide ToolBar when I scrolling content up?
body: <p>I am trying to hide my tool bar when I scroll my text and image with content. Here I use scrollView for getting scroll content. When I scroll content up, how to hide the tool bar?</p>
  <p>Here is my XMl code:</p>
  <p>content_main.XML:</p>
  <pre><code>&lt;android.support.v4.widget.NestedScrollView
  xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;match_parent&quot;
  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  app:layout_behavior=&quot;@string/appbar_scrolling_view_behavior&quot;&gt;
  
  
  &lt;LinearLayout
      android:orientation=&quot;vertical&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;&gt;
  
  &lt;LinearLayout
      android:paddingTop=&quot;?android:attr/actionBarSize&quot;
      android:orientation=&quot;vertical&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;&gt;
  
      &lt;TextView
          android:layout_marginLeft=&quot;10dp&quot;
          android:layout_marginRight=&quot;10dp&quot;
          android:id=&quot;@+id/textone&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:textSize=&quot;23dp&quot;
          android:textStyle=&quot;bold&quot;
          android:text=&quot;hello world jheds sdjhs jds sjbs skjs ksjs kksjs ksj sdd dskd js sk &quot;/&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/imge&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;250dp&quot;
          android:src=&quot;@drawable/imag_bg&quot;/&gt;
  
  
      &lt;TextView
          android:id=&quot;@+id/texttwo&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_marginLeft=&quot;10dp&quot;
          android:layout_marginRight=&quot;10dp&quot;
          android:text=&quot;Pretty good, the Toolbar is moving along with the list and getting back just as we expect it to. This is thanks to the restrictions that we put on the mToolbarOffset variable.
          If we would omit checking if it’s bigger than 0 and lower than mToolbarHeight then when
          we would scroll
           up our list, the Toolbar would move along far away off the screen, so to show it back you
           would have to scroll the list down to 0. Right now it just scrolls up to mToolbarHeight
           position and not more so it’s “sitting” right above the list all of the time and if we
           start scrolling down, we can see it immediately showing.
  
  
  
            up our list, the Toolbar would move along far away off the screen, so to show it back you
           would have to scroll the list down to 0. Right now it just scrolls up to mToolbarHeight
           position and not more so it’s “sitting” right above the list all of the time and if we
           start scrolling down, we can see it immediately showing
  
            up our list, the Toolbar would move along far away off the screen, so to show it back you
           would have to scroll the list down to 0. Right now it just scrolls up to mToolbarHeight
           position and not more so it’s “sitting” right above the list all of the time and if we
           start scrolling down, we can see it immediately showing
  
            up our list, the Toolbar would move along far away off the screen, so to show it back you
           would have to scroll the list down to 0. Right now it just scrolls up to mToolbarHeight
           position and not more so it’s “sitting” right above the list all of the time and if we
           start scrolling down, we can see it immediately showing
  
            up our list, the Toolbar would move along far away off the screen, so to show it back you
           would have to scroll the list down to 0. Right now it just scrolls up to mToolbarHeight
           position and not more so it’s “sitting” right above the list all of the time and if we
           start scrolling down, we can see it immediately showing
  
            up our list, the Toolbar would move along far away off the screen, so to show it back you
           would have to scroll the list down to 0. Right now it just scrolls up to mToolbarHeight
           position and not more so it’s “sitting” right above the list all of the time and if we
           start scrolling down, we can see it immediately showing
          It works pretty well, but this is not what we want. It feels weird that you can
          stop it in the middle of
          the
  
           scroll and the Toolbar will stay half visible. Actually this is how it’s done in Google Play
           Games app
          which I consider as a bug
  
          It works pretty well, but this is not what we want. It feels weird that you can
          stop it in the middle of
          the
           scroll and the Toolbar will stay half visible. Actually this is how it’s done in Google Play
           Games app
          which I consider as a bug
          It works pretty well, but this is not what we want. It feels weird that you can
          stop it in the middle of
          the
           scroll and the Toolbar will stay half visible. Actually this is how it’s done in Google Play
           Games app
          which I consider as a bug.&quot;/&gt;
  
  
  
  
  &lt;/LinearLayout&gt;
  
  &lt;View
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;30dp&quot; /&gt;
  &lt;LinearLayout
  
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;&gt;
      &lt;Button
           android:text=&quot;hai&quot;
           android:layout_width=&quot;160dp&quot;
           android:layout_height=&quot;match_parent&quot; /&gt;
      &lt;Button
           android:text=&quot;hello&quot;
           android:layout_width=&quot;160dp&quot;
           android:layout_height=&quot;match_parent&quot; /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
     
  <p>&lt;/android.support.v4.widget.NestedScrollView&gt;</p>
  <p>activity_main.XML</p>
  <pre><code>&lt;android.support.design.widget.AppBarLayout
      android:layout_height=&quot;wrap_content&quot;
      android:layout_width=&quot;match_parent&quot; 
      android:theme=&quot;@style/AppTheme.AppBarOverlay&quot;&gt;
  
      &lt;android.support.v7.widget.Toolbar 
          android:id=&quot;@+id/toolbar&quot;
          android:layout_width=&quot;match_parent&quot; 
          android:layout_height=&quot;?attr/actionBarSize&quot;
          android:background=&quot;?attr/colorPrimary&quot; 
          app:popupTheme=&quot;@style/AppTheme.PopupOverlay&quot; /&gt;
  
  &lt;/android.support.design.widget.AppBarLayout&gt;
  
  &lt;include layout=&quot;@layout/content_main&quot; /&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/4CN3S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4CN3S.png" alt="here my image" /></a></p>