当前位置:   article > 正文

Android隐藏状态栏、导航栏_android隐藏导航栏动态

android隐藏导航栏动态

Android隐藏状态栏、导航栏

  1. private void hideStatusNavigationBar(){
  2. if(Build.VERSION.SDK_INT<16){
  3. this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
  4. WindowManager.LayoutParams.FLAG_FULLSCREEN);
  5. }else{
  6. int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  7. | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
  8. | View.SYSTEM_UI_FLAG_FULLSCREEN //hide statusBar
  9. | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; //hide navigationBar
  10. getWindow().getDecorView().setSystemUiVisibility(uiFlags);
  11. }
  12. }

Android 动态隐藏显示导航栏,状态栏

一、导航栏:

  1. private void hideNavigationBar() {
  2. View decorView = getWindow().getDecorView();
  3. int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
  4. | View.SYSTEM_UI_FLAG_FULLSCREEN;
  5. decorView.setSystemUiVisibility(uiOptions);
  6. }
  7. private void showNavigationBar() {
  8. View decorView = getWindow().getDecorView();
  9. int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
  10. decorView.setSystemUiVisibility(uiOptions);
  11. }

相关:

 

 

 

 

 

 

 

 

 

 

 

 

二、状态栏:

  1. private void setStatusBarVisible(boolean show) {
  2. if (show) {
  3. int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
  4. uiFlags |= 0x00001000;
  5. getWindow().getDecorView().setSystemUiVisibility(uiFlags);
  6. } else {
  7. int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
  8. | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  9. | View.SYSTEM_UI_FLAG_FULLSCREEN;
  10. uiFlags |= 0x00001000;
  11. getWindow().getDecorView().setSystemUiVisibility(uiFlags);
  12. }
  13. }

三、导航栏和状态栏

  1. private void setSystemUIVisible(boolean show) {
  2. if (show) {
  3. int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
  4. uiFlags |= 0x00001000;
  5. getWindow().getDecorView().setSystemUiVisibility(uiFlags);
  6. } else {
  7. int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
  8. | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
  9. | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  10. | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
  11. | View.SYSTEM_UI_FLAG_FULLSCREEN;
  12. uiFlags |= 0x00001000;
  13. getWindow().getDecorView().setSystemUiVisibility(uiFlags);
  14. }
  15. }

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/635450
推荐阅读
相关标签
  

闽ICP备14008679号