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

public void toggleFullscreen(boolean fullScreen)
 {
  //fullScreen为true时全屏,否则相反
  
     WindowManager.LayoutParams attrs = getWindow().getAttributes();
     
     if (fullScreen)
     {
         attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
     }
     else
     {
         attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
     }
     
     getWindow().setAttributes(attrs);
 }

你可能感兴趣的:(android,it)