I have created a toggle drawer where the drawer will slide from the right automatically when the user has clicked on the item displayed in the content view. However, at this point, the drawer can be manually toggled( user can slide open the drawer by swiping from the edge of the screen) open by user as well as toggled open automatically when user clicked on the displayed item. Hence, I have implemented the following code line as mDrawer.setDrawerLockMode(1, GravityCompat.END);
whereby "1" is defined as:
public static final int LOCK_MODE_LOCKED_CLOSED
The drawer is locked closed. The user may not open it, though the app may open it programmatically.
Constant Value: 1 (0x00000001)
However, when debugged, the result is that user can still manually toggle open the drawer and the drawer can still be toggled automatically when item is clicked.
What is actually the desired toggle result is that only the drawer can be toggled out when the item has been selected and not to give user the privilege to manually toggle the drawer.
Hence, could anyone please help to see what wrong or offer some constructive suggestions?
I have attached the following code for your perusal:
mDrawerToggle = new CustomActionBarDrawerToggle(getActivity(), mDrawer);
mDrawer.openDrawer(GravityCompat.END);
mDrawer.setDrawerListener(mDrawerToggle);
//To lock the drawer from being manually toggled
mDrawer.setDrawerLockMode(1, GravityCompat.END);