Android为FLAG_TRANSLUCENT禁用ActionBar和NavigationBar的覆盖
作者:互联网
从图片中可以看到,导航栏和状态栏覆盖了布局.我所要做的就是
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); w.setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
我尝试通过执行以下操作禁用覆盖:
w.clearFlags(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
w.clearFlags(View.SYSTEM_UI_FLAG_FULLSCREEN);
w.setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
但没有成功. 1up非常感谢您的帮助
谢谢
解决方法:
您正在使用执行此操作的自定义主题吗? android:windowActionBarOverlay这样的设置为true吗?
如果是这样,请在主题中将其禁用.
来源:http://developer.android.com/training/basics/actionbar/overlaying.html
标签:android-actionbar,android 来源: https://codeday.me/bug/20191122/2058356.html