FloatingActionButton behavior api25 失效

解决办法:

应该是android api25的bug吧,bug可以查看https://code.google.com/p/android/issues/detail?id=230298,设置为View.INVISIBLE才有效,View.GONE无效!

如下代码设置:


@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {

    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();
    }
}

你可能感兴趣的:(FloatingActionButton behavior api25 失效)