I found a workaround to achieve what I want:
I initially set drawerMode to CLOSED. After opening it, for example, through a button, I will unlock the box to confirm the gesture again. After closing the drawer, the lock for opening will be activated. For this I use the ActionBarDrawerToggle interface
mDrawerToggle = new ActionBarDrawerToggle(
getActivity(),
mDrawerLayout,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close
)
{
@Override
public void onDrawerClosed(View drawerView)
{
super.onDrawerClosed(drawerView);
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
@Override
public void onDrawerOpened(View drawerView)
{
super.onDrawerOpened(drawerView);
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
};
I tried to get around drawerlayout or parts of it, but it would be nice to get what I want.
I hope this solution will be useful to others.
source
share