Navigation bar is transparent when the keyboard is opened in Immersive mode

Asked

Viewed 14 times

1

I am developing an application in Immersive mode, my problem is when the user will insert some text, when the keyboard opens the navigation bar and notificaton bar are transparent.

This is the code I’m using to leave the application in Immersive mode:

private void setupMainWindowDisplayMode() {

 View decorView = getWindow().getDecorView();

     decorView.setOnSystemUiVisibilityChangeListener(new 

         View.OnSystemUiVisibilityChangeListener() {

             @Override
             public void onSystemUiVisibilityChange(int visibility) {

                hideSystemUI();

        }
   });
 }


 private void hideSystemUI() {

 View decorView = getWindow().getDecorView();

    decorView.setSystemUiVisibility(

            View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                    | 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);
}

I need the navigation bar and notification bar to appear normally when the keyboard is open.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.