unlock drawer_layout when it is locked

后端 未结 2 2015
执念已碎
执念已碎 2020-12-21 17:27

I have a mainactivity where I have created a method to lock/unlock the drawer_layout and locked it in the onCreate() method.

public void disable         


        
相关标签:
2条回答
  • 2020-12-21 18:01

    you have to initialize toggle again.

    toggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); mDrawerLayout.addDrawerListener(toggle);

    After that, it unlocked.

    0 讨论(0)
  • 2020-12-21 18:04

    After struggling a little.. nothing among other solutions in stackoverflow worked for me. My specific problem was also that I was able to lock but not to unlock the DrawerLayout.

    Then I saw in documentation (https://developer.android.com/reference/android/support/v4/widget/DrawerLayout#setdrawerlockmode) that there are two more functions:

    void setDrawerLockMode (int lockMode, View drawerView)
    void setDrawerLockMode (int resId, int edgeGravity)
    

    The second one worked for me like a charm.

    I simply specified the Gravity.LEFT parameter and now all is working perfectly.

    0 讨论(0)
提交回复
热议问题