只有在特定的片段禁用右抽屉抽屉、片段、在特定

2023-09-12 22:13:35 作者:浪女动了情

我有活动 DrawerLayout (其中包含左,右抽屉)。我在想,如果我可以禁用来自特定片段右抽​​屉。

I have Activity with DrawerLayout (which contains left and right drawer). I was wondering if I could disable right drawer from specific fragments.

我读过有关 mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED),但它会锁定整个抽屉关闭,我还需要左抽屉

I've read about mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED), but it would lock whole drawer closed, and I still need the left drawer

推荐答案

DrawerLayout.setDrawerLockMode(INT lockmode可以)锁定所有的抽屉,而是锁定一个特定的抽屉,你可以使用下列之一:

DrawerLayout.setDrawerLockMode(int lockMode) locks all the drawers, but to lock a specific drawer you can use one of the following:

DrawerLayout.setDrawerLockMode(INT lockmode可以,诠释edgeGravity) DrawerLayout.setDrawerLockMode(INT lockmode可以,查看drawerView)