是否可以在横向模式下禁用全屏模式?
如果没有,是否有解决方法?
最佳答案
将这段代码放在 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);
}
关于android - 禁用横向全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12177944/