title: Hide FloatingActionButton on scroll of RecyclerView
body: <p>I want to hide/show <code>FloatingActionButton</code> on scroll of <code>RecyclerView</code>.</p>
  
  <p>My <code>XML</code> layout :</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;android.support.design.widget.CoordinatorLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent" &gt;
  
              &lt;android.support.v7.widget.RecyclerView
                  android:id="@+id/recyclerview_eventlist"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" /&gt;
  
              &lt;android.support.design.widget.FloatingActionButton
                  android:id="@+id/fab_createevent"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="@dimen/fab_margin"
                  app:layout_anchor="@id/recyclerview_eventlist"
                  app:layout_anchorGravity="bottom|right|end"
                  app:layout_behavior="com.eventizon.behavior.ScrollAwareFABBehavior"
                  android:src="@drawable/ic_edit"
                  app:backgroundTint="@color/custom_color_1"
                  app:borderWidth="0dp" /&gt;
          &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>DrawerLayout is the parent layout of this layout.</p>
  
  <pre><code>    public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
  
  
      private static final String TAG = "ScrollAwareFABBehavior";
  
      public ScrollAwareFABBehavior(Context context, AttributeSet attrs) {
          super();
          Log.e(TAG,"ScrollAwareFABBehavior");
      }
  
      @Override
      public void onNestedScroll(CoordinatorLayout coordinatorLayout,
              FloatingActionButton child, View target, int dxConsumed,
              int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
          // TODO Auto-generated method stub
          super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
                  dxUnconsumed, dyUnconsumed);
          Log.e(TAG,"onNestedScroll called");
          if (dyConsumed &gt; 0 &amp;&amp; child.getVisibility() == View.VISIBLE) {
              Log.e(TAG,"child.hide()");
              child.hide();
          } else if (dyConsumed &lt; 0 &amp;&amp; child.getVisibility() != View.VISIBLE) {
              Log.e(TAG,"child.show()");
              child.show();
          }
      }
  }
  </code></pre>
  
  <p>Used this layout behaviour for <code>FloatingActionButton</code>. </p>
  
  <p>When I see <code>logcat</code> only constructor is getting called. <code>onNestedScroll()</code> doesn't get called when I scroll the list.</p>