Android任意时刻、任意代码处全屏

[java]  view plain copy
  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.  }  

你可能感兴趣的:(android)