我们将应用程序定位在api 28上,并在状态栏下绘制内容,为此,我们使用以下标志和样式:
window.addFlags(FLAG_LAYOUT_NO_LIMITS)
<item name="windowNoTitle">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
上
答案 0 :(得分:1)
“问题”是FLAG_LAYOUT_NO_LIMITS行为的基础,并结合了api 29中的新手势功能
https://medium.com/androiddevelopers/gesture-navigation-going-edge-to-edge-812f62e4e83e https://medium.com/androiddevelopers/gesture-navigation-handling-visual-overlaps-4aed565c134c
一个小解决方案是:
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
window.statusBarColor = Color.TRANSPARENT
不要设置
android:fitsSystemWindows
android:windowTranslucentStatus
android:windowIsTranslucent
答案 1 :(得分:1)
在android API 29中,底部栏与内容重叠。
将此代码添加到您的活动中
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
ViewCompat.setOnApplyWindowInsetsListener(getWindow().getDecorView(), new OnApplyWindowInsetsListener() {
@Override
public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
v.setPadding(0, 0, 0, v.getPaddingBottom() + insets.getSystemWindowInsetBottom());
return insets;
}
});
答案 2 :(得分:0)
这应该是您的主要活动
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
,然后为v29创建新的styles.xml文件
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- values-v29/themes.xml -->
<style name="AppTheme"
parent="Theme.AppCompat.Light">
<item name="android:navigationBarColor">
@android:color/black
</item>
<!-- Optional, if drawing behind the status bar too -->
<item name="android:statusBarColor">
@android:color/black
</item>
</style>
</resources>
来源: https://medium.com/androiddevelopers/gesture-navigation-going-edge-to-edge-812f62e4e83e