Reputation: 127
Is it possible to disable full screen mode in Landscape ?
If not, is any workaround?
Upvotes: 3
Views: 1624
Reputation: 56935
Put This code in onCreate() Method.
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
{
//To re-enable full screen:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
//To disable full screen:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
Upvotes: 2