是否可以在横向中禁用全屏模式?
如果没有,是否有任何解决方法?
答案 0 :(得分: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);
}