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.
Asked
Active
Viewed 982 times
1 Answers
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