Why navigation bar is appearing in fullscreen apps when clicked on popup menu

安稳与你 提交于 2019-12-04 07:38:47
Yvette Colomb

You are trying to manage the sticky immersion by calling it in your onresume method. This means once the state has been changed it will not be reinstated until the activity next resumes.

Get rid of this private void removeControlBar()

You need to manage it via the windows onfocuschanged method.

This way alerts can be attended to and the nav bars etc will not return to the view when dealing with the pop ups.

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        decorView.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);
    }
}

The docs Use Sticky Immersion and a detailed explanation here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!