Android Hide Navigation Bar/Stay in Immersive Mode with Soft Keyboard Appearance

后端 未结 6 1376
时光说笑
时光说笑 2020-12-09 03:34

Working on a client\'s app that is using immersive mode to hide the navigation bar and status bar on every activity using the following code:

int currentApiV         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-09 04:01

    Updated:

    I have a painting app (Paint Shapes) and this is the configuration I used to always be inside the immersive mode. I use the onWindowFocusChanged method.

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (hasFocus && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().getDecorView().setSystemUiVisibility(
                    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);
        }
    }
    

提交回复
热议问题