title: Implementing app:hideOnScroll for BottomAppBar in Android
body: <p>I have an app with the one Activity, many Fragments model, where several Fragments have a RecyclerView to show cards with content. I also have implemented the BottomAppBar from Material Design 2.0, and everything is fine except when the AppBar blocks the last CardView in the RecyclerView.</p>
  
  <p>In terms of layout, I have a RecyclerView inside ConstraintLayout inside a Fragment, which sits in a FrameLayout in the main activity. </p>
  
  <p>The documentation shows that for the BottomAppBar to be hidden on Scroll, <a href="https://github.com/material-components/material-components-android/blob/master/docs/components/BottomAppBar.md#hide-on-scroll" rel="nofollow noreferrer">we need to implement RecyclerView inside a NestedScrollView</a>. There is <a href="https://stackoverflow.com/questions/50378848/showing-and-hiding-bottomappbar-on-scroll">one question here on SO</a> where the answer has stated the same as well, but there seems to be no actual documentation or examples to demonstrate how this is to be done, except for <a href="https://medium.com/material-design-in-action/implementing-bottomappbar-behavior-fbfbc3a30568" rel="nofollow noreferrer">this article on Medium</a>, which uses the NestedScrollView in an Activity directly, holding a CoordinatorLayout which holds a ConstraintLayout.</p>
  
  <p>Note: I think it also works on magic, because duplicating the layout in my fragment doesn't have any effect at all in my app.</p>
  
  <p>How do I use NestedScrollView here?</p>
  
  <p>PS : I need to have the TextView, as I set the RecyclerView to VISIBILITY.GONE and set the TextView to VISIBLE when I have no data to display.</p>
  
  <p><strong>Fragment Layout</strong></p>
  
  <pre><code>&lt;android.support.constraint.ConstraintLayout 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/constraintLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="in.domain.APPNAME.Fragments.FragmentList"&gt;
  
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/recyclerViewIncident"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:paddingBottom="30dp"
          android:visibility="visible"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.0"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintVertical_bias="0.0" /&gt;
  
      &lt;TextView
          android:id="@+id/emptyView"
          android:layout_width="wrap_content"
          android:layout_height="17dp"
          android:layout_marginBottom="8dp"
          android:layout_marginEnd="8dp"
          android:layout_marginStart="8dp"
          android:layout_marginTop="8dp"
          android:text="No Incidents to display"
          android:visibility="visible"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.503"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" /&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p><strong>Activity Layout</strong></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:id="@+id/uberLayout"
      tools:context=".APPNAME"&gt;
  
      &lt;android.support.constraint.ConstraintLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;FrameLayout
              android:id="@+id/containerFrameLayout"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
          &lt;/FrameLayout&gt;
  
      &lt;/android.support.constraint.ConstraintLayout&gt;
  
      &lt;android.support.design.widget.CoordinatorLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
  
          &lt;android.support.design.bottomappbar.BottomAppBar
              android:id="@+id/bottom_app_bar"
              style="@style/Widget.MaterialComponents.BottomAppBar"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="bottom"
              app:backgroundTint="@color/colorPrimary"
              app:fabAlignmentMode="center"
              app:navigationIcon="@drawable/baseline_menu_white_24dp"
              app:hideOnScroll="true"
              app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
              app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
          &lt;/android.support.design.bottomappbar.BottomAppBar&gt;
  
          &lt;android.support.design.widget.FloatingActionButton
              android:id="@+id/floatingActionButton"
              android:layout_width="100dp"
              android:layout_height="wrap_content"
              android:clickable="true"
              android:src="@drawable/baseline_add_white_24dp"
              app:backgroundTint="@color/brightred"
              app:fabSize="normal"
              app:layout_anchor="@+id/bottom_app_bar"
              tools:layout_editor_absoluteX="160dp"
              tools:layout_editor_absoluteY="465dp" /&gt;
  
  
      &lt;/android.support.design.widget.CoordinatorLayout&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>