Custom auto hide floatingActionButton behavior is not working

后端 未结 1 1562
Happy的楠姐
Happy的楠姐 2021-01-05 11:03

I\'m trying to hide a FloatingActionButton when a NestedScrollView scroll down, and revealed itself when NestedScrollView scroll up.

Here is my layout:



        
相关标签:
1条回答
  • 2021-01-05 11:14

    Take a look at what @woxingxiao is saying here

    Pretty much onNestedScroll won't get fired if the visibility of the button is GONE. So, replace:

    child.hide();
    

    to:

    child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
        @Override
        public void onHidden(FloatingActionButton fab) {
            super.onHidden(fab);
            fab.setVisibility(View.INVISIBLE);
        }
    });
    
    0 讨论(0)
提交回复
热议问题