Android 动态设置全屏,退出全屏

实现全屏函数:

 

private void setFullScreen(){
     getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
 }

 

退出全屏函数:

 

private void quitFullScreen(){
      final WindowManager.LayoutParams attrs = getWindow().getAttributes();
      attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
      getWindow().setAttributes(attrs);
      getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
  }

 

//设置窗体全屏

 

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

 

 

 

//设置窗体始终点亮

 

getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,

      WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

 

 

//设置窗体背景模糊

 

getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,

                WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

你可能感兴趣的:(android)