首页 > 代码库 > Android开发经验一判断当前屏幕是全屏还是非全屏

Android开发经验一判断当前屏幕是全屏还是非全屏

  1. public void onCreate(Bundle savedInstanceState) {  
  2.         super.onCreate(savedInstanceState);  
  3.         setContentView(R.layout.main);  
  4.           
  5.           
  6.           
  7.           
  8.         int v = this.getWindow().getAttributes().flags;  
  9.         // 全屏 66816 - 非全屏 65792  
  10.         if(v != 66816){//非全屏  
  11.             this.getWindow().setFlags(  
  12.                     WindowManager.LayoutParams.FLAG_FULLSCREEN,  
  13.                     WindowManager.LayoutParams.FLAG_FULLSCREEN);  
  14.         }else{//取消全屏  
  15.             this.getWindow().clearFlags(  
  16.                     WindowManager.LayoutParams.FLAG_FULLSCREEN);  
  17.         }  
  18.   
  19.     }    

Android开发经验一判断当前屏幕是全屏还是非全屏