3

是否可以在 Landscape 中禁用全屏模式?

如果没有,是否有任何解决方法?

4

1 回答 1

2

将此代码放在 onCreate() 方法中。

 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);
}
于 2012-08-29T12:31:36.160 回答