+ drawer.addDrawerListener(new DrawerLayout.DrawerListener() {
+ @Override
+ public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
+ if (slideOffset > 0.2)
+ fabHide();
+ }
+ @Override
+ public void onDrawerOpened(@NonNull View drawerView) {
+ fabHide();
+ }
+ @Override
+ public void onDrawerClosed(@NonNull View drawerView) {
+ fabShouldShow();
+ }
+ @Override
+ public void onDrawerStateChanged(int newState) {}
+ });