-1

更新:我已经解决了这个问题,只是通过监听NestedScrollView的滚动更改事件并在那里做适当的处理。隐藏悬浮动作按钮

我跟随this tutorial动画显示和隐藏我的FloatingActionButton。但它不适合我的布局。我的布局像这样的画面:

enter image description here

它有一个NestedScrollView和一些RecyclerView内。当我通过触摸NestedScrollView的区域进行滚动时,FloatingActionButton按预期动画。但是当我通过触摸RecyclerViews之一的区域进行滚动时,FloatingActionButton根本不会生成动画。当我尝试调试我的代码时,我意识到当我通过触摸RecyclerView的区域进行滚动时,onNestedScroll方法不会被调用。

+0

的可能的复制[FloatingActionButton丝毫不掩饰(http://stackoverflow.com/questions/31269958/floatingactionbutton-doesnt-hide) –

回答

-1

注释掉或从你的XML布局删除此代码块

<android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="16dp" 
     android:clickable="true" 
     android:src="@drawable/ic_done" 
     app:layout_anchor="@id/viewA" 
     app:layout_anchorGravity="bottom|right|end"/>