Disable hamburger to arrow animation

后端 未结 3 677
半阙折子戏
半阙折子戏 2020-12-19 15:36

I am trying to implement a two-drawer layout with the android v7 support library. I have a navigation drawer on the left (Gravity.START) side and a notification drawer on th

相关标签:
3条回答
  • 2020-12-19 16:00

    The above accepted answer not working for me but the below one does

    @Override
    public void onDrawerSlide(View drawerView, float slideOffset) {
        super.onDrawerSlide(drawerView, 0); // this disables the animation 
    }
    
    0 讨论(0)
  • 2020-12-19 16:21

    Since support v7 version 25.3.0, you can disable the animation

    yourActionBarDrawerToggle.setDrawerSlideAnimationEnabled(false);
    
    0 讨论(0)
  • 2020-12-19 16:23

    Along with handling onDrawerSlide you need to handle both onDrawerOpened and onDrawerClosed:

    @Override
    public void onDrawerOpened(View drawerView, float slideOffset) {
        // Make sure it was the navigation drawer
        if(drawerView.equals(navigationDrawer)) {
            super.onDrawerOpened(drawerView, slideOffset);
        }
        else {
            // Do nothing
        }
    }
    
    @Override
    public void onDrawerClosed(View drawerView, float slideOffset) {
        // Make sure it was the navigation drawer
        if(drawerView.equals(navigationDrawer)) {
            super.onDrawerClosed(drawerView, slideOffset);
        }
        else {
            // Do nothing
        }
    }
    
    0 讨论(0)
提交回复
热议问题