androidandroid-animationnavigation-drawerslidingdrawerdrawerlayout

Disable NavigationDrawer icon's slide animation


Is there any way to disable sliding animation of the NavigationDrawer's icon? I mean the effect, when you click the icon or open the Drawer with slide gesture. (I still use the ActionBar at the moment)

Preview

Preview


Solution

  • You need to override the onDrawerSlide method of ActionBarDrawerToggle and set the slideOffset to 0 if the drawer is right drawer. So this would disable the animation of the navigation drawer image.

      @Override
      public void onDrawerSlide(View drawerView, float slideOffset) 
      {
            if(drawerView!=null && drawerView == rightDrawerListView){
                  super.onDrawerSlide(drawerView, 0);
            }else{
                  super.onDrawerSlide(drawerView, slideOffset);
            }
      }