禁用NavigationDrawer图标的幻灯片动画 [英] Disable NavigationDrawer icon's slide animation

查看:98
本文介绍了禁用NavigationDrawer图标的幻灯片动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以禁用NavigationDrawer图标的滑动动画吗?我的意思是当您单击该图标或以滑动手势打开抽屉"时的效果. (目前我仍在使用ActionBar)

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

推荐答案

如果抽屉是右抽屉,则需要覆盖ActionBarDrawerToggleonDrawerSlide方法,并将 slideOffset设置为0 .因此,这将禁用导航抽屉图像的动画.

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);
        }
  }

这篇关于禁用NavigationDrawer图标的幻灯片动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆