【问题标题】:Disable Full screen in landscape禁用横向全屏
【发布时间】:2012-08-24 01:32:02
【问题描述】:

横向模式可以禁用全屏模式吗?

如果没有,有什么解决方法吗?

【问题讨论】:

  • 除非您指定,否则它应该不是全屏!

标签: android landscape landscape-portrait


【解决方案1】:

将此代码放在 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);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-19
    • 2015-03-07
    • 2022-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多