title: Collapsing Toolbar hide when scroll up and show when scroll Down
body: <p>In our chat app new message start first. For see old message user scroll up. For this we set reverseLayout true. </p>
  
  <p>Ex: LayoutManager reverse so 0 position is botttom. when user scroll for old message  suppose position  is 10 . so i want to hide toolbar.when user go below from 10 position to 9 position i want to show toolbar.</p>
  
  <pre><code>LinearLayoutManager linearLayoutManager = new   WrapContentLinearLayoutManager(context);
  linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  linearLayoutManager.setReverseLayout(true);
  </code></pre>
  
  <p>We want to hide collapsing toolbar when user scroll up for fetch old message and show collapsing toolbar when user scroll down.</p>
  
  <p>Any hints on how to achieve this?</p>
  
  <blockquote>
    <p>XML Code as below :</p>
  </blockquote>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout 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:id="@+id/rlMain"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@color/whole_background_color"
  android:orientation="vertical"&gt;
  &lt;ImageView
      android:id="@+id/ivBackgroundWall"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:scaleType="centerCrop" /&gt;
  &lt;android.support.design.widget.CoordinatorLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_above="@+id/rlChatMessageSendView"&gt;
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/app_bar_layout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="#00000000"
          app:elevation="0dp"&gt;
          &lt;android.support.design.widget.CollapsingToolbarLayout
              android:id="@+id/collapsing_toolbar"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              app:layout_scrollFlags="scroll|enterAlways"&gt;
              &lt;include
                  android:id="@+id/rlZoneDetail"
                  layout="@layout/include_layout_zone_option" /&gt;
          &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"
          app:layout_behavior="com.gochat.uIUtil.FixScrollingFooterBehavior"&gt;
          &lt;RelativeLayout
              android:id="@+id/rel_root_recyclerview"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_above="@+id/rlChat"
              android:paddingBottom="@dimen/margin_five"&gt;
              &lt;android.support.v7.widget.RecyclerView
                  android:id="@+id/recyclerViewChat"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:overScrollMode="never"
                  android:scrollbars="none"
                  android:visibility="visible"
                  tools:listitem="@layout/chat_adapter_message_layout" /&gt;
              &lt;ProgressBar
                  android:id="@+id/progressBar"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerInParent="true"
                  android:theme="@style/AppTheme.ProgressBarColor"
                  android:visibility="gone" /&gt;
              &lt;android.support.v7.widget.AppCompatTextView
                  android:id="@+id/tvFollow"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_alignParentEnd="true"
                  android:layout_alignParentRight="true"
                  android:layout_alignParentTop="true"
                  android:layout_marginRight="@dimen/padding_five"
                  android:layout_marginTop="@dimen/padding_ten"
                  android:background="@drawable/background_login_signup_small_radius"
                  android:gravity="center"
                  android:maxLines="1"
                  android:paddingBottom="@dimen/padding_five"
                  android:paddingLeft="@dimen/padding_twenty"
                  android:paddingRight="@dimen/padding_twenty"
                  android:paddingTop="@dimen/padding_five"
                  android:singleLine="true"
                  android:text="@string/start_follow"
                  android:textAllCaps="false"
                  android:textAppearance="?android:attr/textAppearanceMedium"
                  android:textColor="@color/white"
                  android:textSize="@dimen/text_size_fifteen"
                  android:visibility="gone" /&gt;
              &lt;LinearLayout
                  android:id="@+id/llAnnounce"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_alignBottom="@+id/recyclerViewChat"
                  android:layout_alignParentEnd="true"
                  android:layout_alignParentRight="true"
                  android:layout_marginBottom="@dimen/padding_five"
                  android:layout_marginRight="@dimen/padding_five"
                  android:layout_marginTop="@dimen/padding_five"
                  android:background="@drawable/background_login_signup_small_radius"
                  android:gravity="center"
                  android:visibility="gone"&gt;
                  &lt;ImageView
                      android:layout_width="@dimen/padding_thirteen"
                      android:layout_height="@dimen/padding_thirteen"
                      android:layout_marginLeft="@dimen/margin_seven"
                      android:layout_marginStart="@dimen/margin_seven"
                      android:src="@drawable/iv_white_shout" /&gt;
                  &lt;android.support.v7.widget.AppCompatTextView
                      android:id="@+id/tvAnnouncement"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginEnd="@dimen/margin_twenty"
                      android:layout_marginLeft="@dimen/margin_ten"
                      android:layout_marginRight="@dimen/margin_twenty"
                      android:layout_marginStart="@dimen/margin_ten"
                      android:gravity="center"
                      android:maxLines="1"
                      android:paddingBottom="@dimen/padding_five"
                      android:paddingTop="@dimen/padding_five"
                      android:singleLine="true"
                      android:text="@string/announce_text"
                      android:textAllCaps="false"
                      android:textAppearance="?android:attr/textAppearanceMedium"
                      android:textColor="@color/white"
                      android:textSize="@dimen/text_size_thirteen"
                      android:visibility="visible" /&gt;
                  &lt;ImageView
                      android:layout_width="@dimen/padding_thirteen"
                      android:layout_height="@dimen/padding_thirteen"
                      android:layout_marginEnd="@dimen/margin_seven"
                      android:layout_marginRight="@dimen/margin_seven"
                      android:src="@drawable/iv_white_send" /&gt;
              &lt;/LinearLayout&gt;
          &lt;/RelativeLayout&gt;
          &lt;LinearLayout
              android:id="@+id/rlChat"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_gravity="bottom"
              android:background="@color/bg_bottombar"
              android:orientation="vertical"
              android:visibility="visible"
              app:layout_behavior="com.gochat.uIUtil.FixScrollingFooterBehavior"&gt;
              &lt;View
                  android:layout_width="match_parent"
                  android:layout_height="@dimen/onedp"
                  android:background="@color/create_zone_divider_color_whatsapp" /&gt;
              &lt;RelativeLayout
                  android:id="@+id/rl_send_message"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@color/bottom_tab"
                  android:padding="@dimen/padding_seven"
                  android:visibility="visible"&gt;
                  &lt;RelativeLayout
                      android:id="@+id/rlAdd"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentLeft="true"
                      android:layout_alignParentStart="true"
                      android:layout_centerVertical="true"
                      android:paddingBottom="@dimen/padding_ten"
                      android:paddingRight="@dimen/margin_eight"
                      android:paddingTop="@dimen/padding_ten"&gt;
                      &lt;ImageView
                          android:id="@+id/ivAdd"
                          android:layout_width="@dimen/margin_twenty"
                          android:layout_height="@dimen/margin_twenty"
                          android:layout_centerVertical="true"
                          android:src="@drawable/iv_add_blue" /&gt;
                  &lt;/RelativeLayout&gt;
                  &lt;ImageView
                      android:id="@+id/ivFullscreen"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentEnd="true"
                      android:layout_alignParentRight="true"
                      android:layout_centerVertical="true"
                      android:src="@drawable/iv_add_blue"
                      android:visibility="gone" /&gt;
                  &lt;ImageView
                      android:id="@+id/ivMenuOpen"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_below="@+id/rel_message"
                      android:layout_centerVertical="true"
                      android:layout_marginEnd="@dimen/margin_twenty"
                      android:layout_marginRight="@dimen/margin_twenty"
                      android:layout_toLeftOf="@+id/ivFullscreen"
                      android:layout_toStartOf="@+id/ivFullscreen"
                      android:src="@drawable/iv_menu_grid"
                      android:visibility="gone" /&gt;
                  &lt;TextView
                      android:id="@+id/tv_Title"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_centerInParent="true"
                      android:gravity="center"
                      android:text="TITLE"
                      android:textStyle="bold"
                      android:visibility="gone" /&gt;
                  &lt;RelativeLayout
                      android:id="@+id/rel_message"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_centerVertical="true"
                      android:layout_toEndOf="@+id/rlAdd"
                      android:layout_toLeftOf="@+id/iv_send"
                      android:layout_toRightOf="@+id/rlAdd"
                      android:layout_toStartOf="@+id/iv_send"
                      android:background="@drawable/chat_send_message_background"
                      android:visibility="visible"&gt;
                      &lt;RelativeLayout
                          android:id="@+id/rl_chat_send_message"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_centerVertical="true"
                          android:orientation="horizontal"&gt;
                          &lt;EditText
                              android:id="@+id/et_chat"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_marginEnd="@dimen/margin_ten"
                              android:layout_marginLeft="@dimen/margin_ten"
                              android:layout_marginRight="@dimen/margin_ten"
                              android:layout_marginStart="@dimen/margin_ten"
                              android:background="@null"
                              android:hint="@string/type_messsage"
                              android:inputType="textMultiLine"
                              android:maxLines="4"
                              android:padding="@dimen/padding_eight"
                              android:textColorHint="@color/hint_text_color"
                              android:textSize="@dimen/text_size_fifteen"
                              tools:text="zxnihxkbdfcdaaa" /&gt;
                      &lt;/RelativeLayout&gt;
                  &lt;/RelativeLayout&gt;
                  &lt;ImageView
                      android:id="@+id/iv_send"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentEnd="true"
                      android:layout_alignParentRight="true"
                      android:layout_centerVertical="true"
                      android:layout_margin="@dimen/margin_five"
                      android:src="@drawable/iv_send_message_light"
                      android:visibility="invisible" /&gt;
                  &lt;ImageView
                      android:id="@+id/iv_record"
                      android:layout_width="30dp"
                      android:layout_height="30dp"
                      android:layout_alignParentEnd="true"
                      android:layout_alignParentRight="true"
                      android:layout_centerVertical="true"
                      android:layout_margin="@dimen/margin_five"
                      android:src="@drawable/iv_audio_record"
                      android:visibility="visible" /&gt;
              &lt;/RelativeLayout&gt;
              &lt;FrameLayout
                  android:id="@+id/frame_layout"
                  android:layout_width="match_parent"
                  android:layout_height="250dp"
                  android:background="@color/white"
                  android:padding="@dimen/padding_fifteen"
                  android:visibility="gone" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/RelativeLayout&gt;
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  &lt;RelativeLayout
      android:id="@+id/rlChatMessageSendView"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"&gt;
      &lt;LinearLayout
          android:id="@+id/llSpectatorZone"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_marginTop="@dimen/margin_ten"
          android:background="@color/white"
          android:orientation="horizontal"
          android:padding="@dimen/padding_ten"
          android:visibility="gone"&gt;
          &lt;TextView
              android:id="@+id/tvSpectatorZone"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="center"
              android:text="@string/you_can_only_view_this_zone"
              android:textColor="@color/unselected_item_color"
              android:textSize="@dimen/text_size_seventeen" /&gt;
      &lt;/LinearLayout&gt;
    &lt;/RelativeLayout&gt;
   &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/7TQvn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7TQvn.png" alt="enter image description here"></a></p>