disable the swipe gesture that opens the navigation drawer in android

Add gravity value too when using setDrawerLockMode();

Do this :

drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, GravityCompat.END);

This should work like a charm


for locking you can do this:

mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

and for unlock :

mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);

You should use:

mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

It worked for me, the swipe to open the drawer was disabled.

If it still won't work, check out the answer provided here.