问题描述
在一个全屏界面,使用WindowManager显示弹窗后,会拉起底部导航栏
解决
尝试发现设置WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE属性可以正确隐藏导航栏
WindowManager.LayoutParams windowLayoutParams = getWindow().getAttributes();
windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
getWindow().setAttributes(windowLayoutParams);
可主动隐藏systemui代码
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);