当前位置: 代码迷 >> Android >> 使APP默许全屏的代码
  详细解决方案

使APP默许全屏的代码

热度:38   发布时间:2016-04-27 22:07:16.0
使APP默认全屏的代码
 1  public void toggleFullscreen(boolean fullScreen) { 2         // fullScreen为true时全屏,否则相反 3  4         WindowManager.LayoutParams attrs = getWindow().getAttributes(); 5  6         if (fullScreen) { 7             attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; 8         } else { 9             attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;10         }11 12         getWindow().setAttributes(attrs);13     }

要使用的时候直接调用方法boolean为true

  相关解决方案