赞
踩
- private void hideStatusNavigationBar(){
- if(Build.VERSION.SDK_INT<16){
- this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
- }else{
- int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN //hide statusBar
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; //hide navigationBar
- getWindow().getDecorView().setSystemUiVisibility(uiFlags);
- }
- }
一、导航栏:
- private void hideNavigationBar() {
- View decorView = getWindow().getDecorView();
- int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN;
- decorView.setSystemUiVisibility(uiOptions);
- }
-
- private void showNavigationBar() {
- View decorView = getWindow().getDecorView();
- int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
- decorView.setSystemUiVisibility(uiOptions);
- }
相关:
二、状态栏:
- private void setStatusBarVisible(boolean show) {
- if (show) {
- int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
- uiFlags |= 0x00001000;
- getWindow().getDecorView().setSystemUiVisibility(uiFlags);
- } else {
- int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_FULLSCREEN;
- uiFlags |= 0x00001000;
- getWindow().getDecorView().setSystemUiVisibility(uiFlags);
- }
- }
三、导航栏和状态栏
- private void setSystemUIVisible(boolean show) {
- if (show) {
- int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
- uiFlags |= 0x00001000;
- getWindow().getDecorView().setSystemUiVisibility(uiFlags);
- } else {
- int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN;
- uiFlags |= 0x00001000;
- getWindow().getDecorView().setSystemUiVisibility(uiFlags);
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。