Dismiss Android PopUpWindow 对象使状态栏可见。如何阻止这个?

Dismiss Android PopUpWindow object makes the status bar visible. How to stop this?

我有一个 Activity 全屏。我正在使用以下代码制作全屏 activity(我在 onResume 方法中调用)

int currentApiVersion = Build.VERSION.SDK_INT;

    final int flags = 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
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;

    // This work only for android 4.4+
    if (currentApiVersion >= Build.VERSION_CODES.KITKAT) {
        activity.getWindow().getDecorView().setSystemUiVisibility(flags);
        // Code below is to handle presses of Volume up or Volume down.
        // Without this, after pressing volume buttons, the navigation bar will
        // show up and won't hide
        final View decorView = activity.getWindow().getDecorView();
        decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int visibility) {
                if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                    decorView.setSystemUiVisibility(flags);
                }
            }
        });
    }

在此 Activity 中,我打开了一个 PopUpWindow 对象。但是打开这个之后,状态栏就变得可见了。如何阻止它?

为了显示 PopUpWindow,我使用以下代码:

popupWindow = new PopupWindow(layout, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT, true); popupWindow.showAtLocation(布局, Gravity.NO_GRAVITY, 0, 0);

我无法弄清楚这些方法有什么问题。请帮忙。提前致谢。

更改实施方式并在您的 onCreate 中应用此代码 Activity 并确保在 setContentView() 之前在 OnCreate 中添加一件事

@Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

            setContentView(R.layout.splash_layout);
    }