我想锁定DrawerLayout的左右和左右滑动.
DrawerLayout drawerLayout;
的onCreate:
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN); drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
单击按钮打开drawerLayout:
drawerLayout.openDrawer(Gravity.LEFT);
并关闭:
drawerLayout.closeDrawers();
我在onCreate,onResume,onStart中尝试setDrawerLockMode但是没有工作,它仍然可以打开,关闭时滑动它.
编辑2:
它适用于:
android:layout_gravity="start"
而不是与:
android:layout_gravity="start|bottom"
任何帮助.谢谢.