Android 弹出Dialog时隐藏状态栏和底部导航栏

上代码

dialog.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
dialog.getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
          @Override
          public void onSystemUiVisibilityChange(int visibility) {
                  int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
                  //布局位于状态栏下方
                  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
                  //全屏
                  View.SYSTEM_UI_FLAG_FULLSCREEN |
                  //隐藏导航栏
                  View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
                  View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
                  uiOptions |= 0x00001000;
                  dialog.getWindow().getDecorView().setSystemUiVisibility(uiOptions);
          }
});

 

posted @ 2019-07-02 15:40  YangBryant  阅读(7646)  评论(3编辑  收藏  举报