I am implementing the navigation view in my app.
Actually, I can open it both clicking on "hamburger" icon (in my toolbar) and swypeing from left to right.
I want to open it only through the icon in my toolbar disabling the swype. Is it possible to do that?
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, sToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
EDIT
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); // HERE
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, sToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
If I use the code above, where I used DrawerLayout.LOCK_MODE_LOCKED_CLOSED, I disable both icon and swype.
This works for my case
Lock it:
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
And unlock it :
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
Hope to help!