0

Is it possible to hide fab button when scrolling down with Webview and appear when scrolling up? Like with the Recycler View effect/animation with fab.

JanJan
  • 13
  • 5
  • Try this : http://stackoverflow.com/questions/37893937/how-to-hide-and-show-fab-on-scroll-of-webview-without-using-nestedscrollview – BenjaminBihr Mar 05 '17 at 11:16

1 Answers1

0

@TargetApi is required as setOnScrollChangeListener() doesnt work for under 23 apis.

@TargetApi(23)
public void hideFabOnScroll(){
    webView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
        @Override
        public void onScrollChange(View v, int scrollX, int scrollY, oldScrollX, int oldScrollY) {
            if (scrollY > oldScrollY)
                fab.hide();
            else if (scrollY < oldScrollY)
                fab.show();

        }
    });
}
realpac
  • 537
  • 6
  • 13