Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DrawerLayout lock mode doesnt work as expected

My code below locks the drawerlayout when using a tablet (in landscape mode)

if(condition)
{
    //Landscape mode
    mDrawerLayout.SetDrawerLockMode(DrawerLayout.LockModeLockedOpen);
    mDrawerLayout.SetScrimColor(Color.Transparent);
}
else
{
    //Portrait mode
    mDrawerLayout.SetDrawerLockMode(DrawerLayout.LockModeUnlocked);
    mDrawerLayout.SetScrimColor(Color.LightGray);
}

However, if I open it up in landscape it locks the drawerlayout as expected, however when changing it to portrait mode I cannot swipe it away. It does the opposite when opening it up in portrait (allows me to open and close) but then changing to landscape it opens it but doesn't lock it in so the user can swipe it away and break the view.

Not to sure what I am missing, as I have stepped through the code countless times and it follows the right paths.

like image 740
Johan Avatar asked Jan 31 '14 12:01

Johan


1 Answers

I had the same issue and moving that code to my onResume() did the trick.

like image 50
elmango Avatar answered Oct 06 '22 04:10

elmango