Disable gesture listener on DrawerLayout

Solution 1:

This worked for me:

mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

You can expand the drawer by tapping the Home button, and can use right-to-left swipe gesture to dismiss it. However, left-to-right swipe is no longer triggered.

Solution 2:

For setDrawerLockMode(), this is in the code but not on the Android developer docs:

/**
 * The drawer is unlocked.
 */
public static final int LOCK_MODE_UNLOCKED = 0;

/**
 * The drawer is locked closed. The user may not open it, though
 * the app may open it programmatically.
 */
public static final int LOCK_MODE_LOCKED_CLOSED = 1;

/**
 * The drawer is locked open. The user may not close it, though the app
 * may close it programmatically.
 */
public static final int LOCK_MODE_LOCKED_OPEN = 2;