使APP默许全屏的代码

使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