robert
robert

Reputation: 127

Disable Full screen in landscape

Is it possible to disable full screen mode in Landscape ?

If not, is any workaround?

Upvotes: 3

Views: 1624

Answers (1)

Chirag
Chirag

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

Related Questions