一个app中保持程序全屏的方法。

 1 public void toggleFullscreen(boolean fullScreen)  
 2  {  
 3   //fullScreen为true时全屏 
 4     
 5      WindowManager.LayoutParams attrs = getWindow().getAttributes();  
 6        
 7      if (fullScreen)  
 8      {  
 9          attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;  
10      }  
11      else  
12      {  
13          attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;  
14      }  
15        
16      getWindow().setAttributes(attrs);  
17  }