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

openkk 13年前

public void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentView(R.layout.main);                                                  int v = this.getWindow().getAttributes().flags;          // 全屏 66816 - 非全屏 65792          if(v != 66816){//非全屏           this.getWindow().setFlags(                      WindowManager.LayoutParams.FLAG_FULLSCREEN,                      WindowManager.LayoutParams.FLAG_FULLSCREEN);          }else{//取消全屏           this.getWindow().clearFlags(                      WindowManager.LayoutParams.FLAG_FULLSCREEN);          }        }