fab 隐藏后不显示

Currently CoordinatorLayout is skipping views set to GONE when looking for behaviours to call in its onNestedScroll method.
A quick workaround here is setting the FAB’s visibility to INVISIBLE at the end of the FAB’s hide animation.

1
2
3
4
5
6
7
8
9
10
11
if(dyConsumed>0&&child.getVisibility()==View.VISIBLE) {
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton fab) {
super.onHidden(fab);
fab.setVisibility(View.INVISIBLE);
}
});
}else if(dyConsumed<0&&child.getVisibility()!=View.VISIBLE){
child.show();
}