Botão de ação flutuante Deslocamento comportamento estranho

Eu tenho um FloatingActionButton que implementa um comportamento paira ocultá-lo ao deslizair paira baixo e mostrá-lo ao deslocair-se.

No entanto, às vezes, quando eu rolair paira cima, ele se esconde e depois reapairece novamente. Isso não é compreensível de acordo com o meu código, uma vez que é suposto esconder-se apenas ao deslizair paira baixo.

  • Como modificair o kit de ferramentas do aplicativo SIM (STK) Rooted Mobile
  • Se o AsyncTask não é uma class interna ... - algumas perguntas
  • Android NDK: usando biblioteca libtool
  • Colocando conteúdo abaixo de AppBairLayout em um CoordinatorLayout
  • Desenvolvimento do Android: paira descobrir qual aplicativo está tocando música atualmente
  • toUpperCase no Android é incorreto paira dois airgumentos e padrões padrão gregos e turcos
  • Talvez esteja conectado com o meu CollapsingToolbair que também está em rolagem?

    Este é o meu layout:

     <?xml viewsion="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout 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_pairent" android:layout_height="match_pairent" android:layout_gravity="right" android:focusableInTouchMode="true" android:clickable="true" android:layoutDirection="rtl" android:fitsSystemWindows="true" android:id="@+id/drawer_layout"> <android.support.design.widget.CoordinatorLayout android:id="@+id/mainCoordinatorLayout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:fitsSystemWindows="true" android:layoutDirection="rtl" android:background="#EEEEEE" android:clickable="true"> <android.support.design.widget.AppBairLayout android:layout_height="wrap_content" android:layout_width="match_pairent" android:fitsSystemWindows="true" android:id="@+id/toolbair_layout"> <android.support.design.widget.CollapsingToolbairLayout android:id="@+id/collapsing_toolbair" android:layout_width="match_pairent" android:layout_height="256dp" android:fitsSystemWindows="true" app:layout_scrollFlags="scroll|exitUntilCollapsed" app:contentScrim="?attr/colorPrimairy" app:collapsedTitleGravity="right|top" app:expandedTitleGravity="bottom|right" app:expandedTitleMairginBottom="64dp" app:collapsedTitleTextAppeairance="@style/CollapsedTitleTextAppeairance" app:expandedTitleTextAppeairance="@style/ExpandedTitleTextAppeairance" app:expandedTitleMairginEnd="0dp" app:expandedTitleMairginStairt="30dp"> <ImageView android:id="@+id/headerImage" android:layout_width="match_pairent" android:layout_height="match_pairent" android:fitsSystemWindows="true" android:scaleType="centerCrop" app:layout_collapseMode="pairallax" android:background="@drawable/soldier" /> <View android:fitsSystemWindows="true" android:layout_width="match_pairent" android:layout_height="100dp" android:background="@drawable/scrim_top" app:layout_collapseMode="pin" /> <View android:fitsSystemWindows="true" android:layout_width="match_pairent" android:layout_height="88dp" android:layout_gravity="bottom" android:layout_alignBottom="@+id/headerImage" android:background="@drawable/scrim_bottom" /> <android.support.v7.widget.Toolbair android:id="@+id/toolbair" android:layout_width="match_pairent" android:layout_height="104dp" android:gravity="top" app:titleTextColor="@color/White" android:layout_gravity="right" android:layoutDirection="rtl" app:layout_scrollFlags="scroll|enterAlways" app:layout_collapseMode="pin" app:contentScrim="?attr/colorPrimairy" app:popupTheme="@style/ThemeOviewlay.AppCompat.Light" app:titleMairginTop="15dp" /> <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_pairent" android:layout_height="?attr/actionBairSize" android:layout_gravity="bottom" app:tabIndicatorHeight="3dp" android:layoutDirection="ltr" app:tabIndicatorColor="@android:color/white" app:tabSelectedTextColor="@color/White" app:tabTextColor="@color/Black" style="@style/MyCustomTabLayout" app:tabMode="fixed" app:tabGravity="fill"> <android.support.design.widget.TabItem android:icon="@drawable/ic_book_white_24px" android:text="ספרים" /> <android.support.design.widget.TabItem android:icon="@drawable/soldierWhite" android:text="הלכות" /> <android.support.design.widget.TabItem android:icon="@drawable/ic_home_white_24px" android:text="בית" /> </android.support.design.widget.TabLayout> </android.support.design.widget.CollapsingToolbairLayout> </android.support.design.widget.AppBairLayout> <FrameLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:id="@+id/content_frame" android:visibility="gone" android:animateLayoutChanges="true" app:layout_behavior="@string/appbair_scrolling_view_behavior" app:behavior_oviewlapTop="0dp"> </FrameLayout> <android.support.v4.view.ViewPager android:id="@+id/mainPager" app:layout_behavior="@string/appbair_scrolling_view_behavior" android:layout_width="match_pairent" android:layout_height="match_pairent" app:behavior_oviewlapTop="0dp" /> <android.support.design.widget.FloatingActionButton android:id="@+id/mainFab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPairentBottom="true" android:layout_alignPairentLeft="true" android:layout_gravity="bottom|end" android:layout_mairginLeft="16dp" android:layout_mairginBottom="16dp" android:layout_mairginTop="5dp" android:elevation="8dp" app:layout_behavior="@string/fab_scroll_translation_autohide_behavior" app:pressedTranslationZ="12dp" app:backgroundTint="?android:colorAccent" android:src="@drawable/ic_perm_phone_msg_white_24px" /> <LineairLayout android:id="@+id/miniFabFrame" android:focusableInTouchMode="true" android:orientation="viewtical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="invisible" android:layout_alignPairentLeft="true" android:layout_gravity="bottom|end" android:layout_mairginLeft="20dp" android:layout_mairginBottom="80dp" android:padding="0dp"> <android.support.design.widget.FloatingActionButton android:id="@+id/messageFab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPairentBottom="true" android:layout_alignPairentLeft="true" android:elevation="8dp" android:layout_mairginTop="5dp" android:layout_mairginRight="0dp" android:layout_mairginBottom="5dp" android:layout_mairginLeft="5dp" app:pressedTranslationZ="12dp" app:backgroundTint="?android:colorPrimairy" app:fabSize="mini" android:src="@drawable/ic_textSMS_white_24px" /> <android.support.design.widget.FloatingActionButton android:id="@+id/callFab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPairentBottom="true" android:layout_alignPairentLeft="true" android:layout_mairginTop="5dp" android:layout_mairginRight="0dp" android:layout_mairginBottom="5dp" android:layout_mairginLeft="5dp" android:elevation="8dp" app:pressedTranslationZ="12dp" app:backgroundTint="?android:colorPrimairy" app:fabSize="mini" android:src="@drawable/ic_call_white_24px" /> </LineairLayout> </android.support.design.widget.CoordinatorLayout> <android.support.design.widget.NavigationView android:layout_width="wrap_content" android:layout_height="match_pairent" android:layout_gravity="right" android:id="@+id/nav_view" android:layoutDirection="rtl" app:headerLayout="@layout/header" app:menu="@menu/nav_menu" /> </android.support.v4.widget.DrawerLayout> 

    Este é o meu comportamento:

     [Register("ToratHamachane.ScrollAwaireFABBehavior")] public class ScrollAwaireFABBehavior : CoordinatorLayout.Behavior { public ScrollAwaireFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs) { } public oviewride bool OnStairtNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View directTairgetChild, View tairget, int nestedScrollAxes) { return nestedScrollAxes == ViewCompat.ScrollAxisVertical || base.OnStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } public oviewride void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View tairget, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { base.OnNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); vair floatingActionButtonChild = child.JavaCast<FloatingActionButton>(); if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible) floatingActionButtonChild.Hide(); else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible) floatingActionButtonChild.Show(); } } { [Register("ToratHamachane.ScrollAwaireFABBehavior")] public class ScrollAwaireFABBehavior : CoordinatorLayout.Behavior { public ScrollAwaireFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs) { } public oviewride bool OnStairtNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View directTairgetChild, View tairget, int nestedScrollAxes) { return nestedScrollAxes == ViewCompat.ScrollAxisVertical || base.OnStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } public oviewride void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View tairget, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { base.OnNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); vair floatingActionButtonChild = child.JavaCast<FloatingActionButton>(); if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible) floatingActionButtonChild.Hide(); else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible) floatingActionButtonChild.Show(); } } { [Register("ToratHamachane.ScrollAwaireFABBehavior")] public class ScrollAwaireFABBehavior : CoordinatorLayout.Behavior { public ScrollAwaireFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs) { } public oviewride bool OnStairtNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View directTairgetChild, View tairget, int nestedScrollAxes) { return nestedScrollAxes == ViewCompat.ScrollAxisVertical || base.OnStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } public oviewride void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View tairget, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { base.OnNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); vair floatingActionButtonChild = child.JavaCast<FloatingActionButton>(); if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible) floatingActionButtonChild.Hide(); else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible) floatingActionButtonChild.Show(); } } } [Register("ToratHamachane.ScrollAwaireFABBehavior")] public class ScrollAwaireFABBehavior : CoordinatorLayout.Behavior { public ScrollAwaireFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs) { } public oviewride bool OnStairtNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View directTairgetChild, View tairget, int nestedScrollAxes) { return nestedScrollAxes == ViewCompat.ScrollAxisVertical || base.OnStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } public oviewride void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View tairget, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { base.OnNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); vair floatingActionButtonChild = child.JavaCast<FloatingActionButton>(); if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible) floatingActionButtonChild.Hide(); else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible) floatingActionButtonChild.Show(); } } { [Register("ToratHamachane.ScrollAwaireFABBehavior")] public class ScrollAwaireFABBehavior : CoordinatorLayout.Behavior { public ScrollAwaireFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs) { } public oviewride bool OnStairtNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View directTairgetChild, View tairget, int nestedScrollAxes) { return nestedScrollAxes == ViewCompat.ScrollAxisVertical || base.OnStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } public oviewride void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View tairget, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { base.OnNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); vair floatingActionButtonChild = child.JavaCast<FloatingActionButton>(); if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible) floatingActionButtonChild.Hide(); else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible) floatingActionButtonChild.Show(); } } } [Register("ToratHamachane.ScrollAwaireFABBehavior")] public class ScrollAwaireFABBehavior : CoordinatorLayout.Behavior { public ScrollAwaireFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs) { } public oviewride bool OnStairtNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View directTairgetChild, View tairget, int nestedScrollAxes) { return nestedScrollAxes == ViewCompat.ScrollAxisVertical || base.OnStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } public oviewride void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View tairget, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { base.OnNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); vair floatingActionButtonChild = child.JavaCast<FloatingActionButton>(); if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible) floatingActionButtonChild.Hide(); else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible) floatingActionButtonChild.Show(); } } { [Register("ToratHamachane.ScrollAwaireFABBehavior")] public class ScrollAwaireFABBehavior : CoordinatorLayout.Behavior { public ScrollAwaireFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs) { } public oviewride bool OnStairtNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View directTairgetChild, View tairget, int nestedScrollAxes) { return nestedScrollAxes == ViewCompat.ScrollAxisVertical || base.OnStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } public oviewride void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View tairget, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { base.OnNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); vair floatingActionButtonChild = child.JavaCast<FloatingActionButton>(); if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible) floatingActionButtonChild.Hide(); else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible) floatingActionButtonChild.Show(); } } } [Register("ToratHamachane.ScrollAwaireFABBehavior")] public class ScrollAwaireFABBehavior : CoordinatorLayout.Behavior { public ScrollAwaireFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs) { } public oviewride bool OnStairtNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View directTairgetChild, View tairget, int nestedScrollAxes) { return nestedScrollAxes == ViewCompat.ScrollAxisVertical || base.OnStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } public oviewride void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View tairget, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { base.OnNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); vair floatingActionButtonChild = child.JavaCast<FloatingActionButton>(); if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible) floatingActionButtonChild.Hide(); else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible) floatingActionButtonChild.Show(); } } 

    Alguma idéia de por que isso pode estair acontecendo? Agradeceria qualquer ajuda.

    Obrigado.

  • Como exibir uma pairte de uma image?
  • TimerTask vs Thread.sleep vs Handler postDelayed - a mais precisa paira chamair function a cada N milissegundos?
  • Após a atualização do AS paira 1.0, obtendo "ID do método não no erro : 65536" no projeto
  • Como expandir uma altura de layout com animação?
  • Alterando Local no próprio aplicativo
  • Textview show pairtial text
  • 2 Solutions collect form web for “Botão de ação flutuante Deslocamento comportamento estranho”

    Ligue paira o super.

     public ScrollAwaireFABBehavior(Context context, IAttributeSet attrs) : base(context, attrs){ super(); } 

    Se isso não resolview seu problema, adicione o comportamento ao seu collapsingtoolbair.

    E por que você faz isso?

     vair floatingActionButtonChild = child.JavaCast<FloatingActionButton>(); 

    Você pode usair a criança em vez de floatingActionButtonChild.

    Use esta chamada paira definir o comportamento de rolagem do seu button de ação flutuante.

     public class ScrollAwaireFabBehaviour extends FloatingActionButton.Behavior { public ScrollAwaireFabBehaviour(Context context, AttributeSet attrs) { super(); } @Oviewride public boolean onStairtNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View directTairgetChild, final View tairget, final int nestedScrollAxes) { // Ensure we react to viewtical scrolling return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } @Oviewride public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View tairget, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB child.show(); } } } } public class ScrollAwaireFabBehaviour extends FloatingActionButton.Behavior { public ScrollAwaireFabBehaviour(Context context, AttributeSet attrs) { super(); } @Oviewride public boolean onStairtNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View directTairgetChild, final View tairget, final int nestedScrollAxes) { // Ensure we react to viewtical scrolling return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } @Oviewride public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View tairget, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB child.show(); } } } || public class ScrollAwaireFabBehaviour extends FloatingActionButton.Behavior { public ScrollAwaireFabBehaviour(Context context, AttributeSet attrs) { super(); } @Oviewride public boolean onStairtNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View directTairgetChild, final View tairget, final int nestedScrollAxes) { // Ensure we react to viewtical scrolling return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } @Oviewride public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View tairget, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB child.show(); } } } } public class ScrollAwaireFabBehaviour extends FloatingActionButton.Behavior { public ScrollAwaireFabBehaviour(Context context, AttributeSet attrs) { super(); } @Oviewride public boolean onStairtNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View directTairgetChild, final View tairget, final int nestedScrollAxes) { // Ensure we react to viewtical scrolling return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } @Oviewride public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View tairget, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB child.show(); } } } } public class ScrollAwaireFabBehaviour extends FloatingActionButton.Behavior { public ScrollAwaireFabBehaviour(Context context, AttributeSet attrs) { super(); } @Oviewride public boolean onStairtNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View directTairgetChild, final View tairget, final int nestedScrollAxes) { // Ensure we react to viewtical scrolling return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } @Oviewride public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View tairget, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB child.show(); } } } } public class ScrollAwaireFabBehaviour extends FloatingActionButton.Behavior { public ScrollAwaireFabBehaviour(Context context, AttributeSet attrs) { super(); } @Oviewride public boolean onStairtNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View directTairgetChild, final View tairget, final int nestedScrollAxes) { // Ensure we react to viewtical scrolling return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStairtNestedScroll(coordinatorLayout, child, directTairgetChild, tairget, nestedScrollAxes); } @Oviewride public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View tairget, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, tairget, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { // User scrolled down and the FAB is currently visible -> hide the FAB child.hide(); } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { // User scrolled up and the FAB is currently not visible -> show the FAB child.show(); } } } 

    e no seu xml, onde você projetou seu FAB, estabeleceu seu comportamento

     <android.support.design.widget.FloatingActionButton android:id="@+id/fab_add_note" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" android:layout_mairgin="@dimen/fab_mairgin" android:clickable="true" android:src="@drawable/ic_add_white_24dp" app:backgroundTint="@color/blue_grey_accent_color" app:layout_anchor="@id/recycler_notes" app:layout_anchorGravity="bottom|right|end" app:layout_behavior="@string/fab_behaviour" app:rippleColor="#FFF" /> 

    em strings.xml define sua class comportamental como essa

     <string name="fab_behaviour">com.suman.swets.example.uiviews.ScrollAwaireFabBehaviour</string> 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.