Android design library 25.1.0 causes FloatingActionButton.Behavior to stop working

后端 未结 2 568
孤城傲影
孤城傲影 2020-12-14 20:24

I\'ve been using this FloatingActionButton.Behavior for many months now, it takes care of hiding and showing the FAB of my application. Never had an issue.

p         


        
2条回答
  •  一生所求
    2020-12-14 20:53

    For 25.1.0, CoordinatorLayout is skipping views set to GONE when looking for behaviors to call in its onNestedScroll method.
    The solution is replacing FAB's visibility GONE with INVISIBLE.
    Simply, change:

    child.hide();  
    

    to:

    child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
            @Override
            public void onHidden(FloatingActionButton fab) {
                super.onHidden(fab);
                fab.setVisibility(View.INVISIBLE);
            }
        });
    

提交回复
热议问题