Nin*_*nea 6 android navigationbar android-layout android-styles android-10.0
我们将我们的应用程序定位在 api 28 并在状态栏下绘制内容。为此,我们使用以下标志和样式:
window.addFlags(FLAG_LAYOUT_NO_LIMITS)
Run Code Online (Sandbox Code Playgroud)
<item name="windowNoTitle">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
Run Code Online (Sandbox Code Playgroud)
Android Pie 上一切正常(状态栏下方和导航栏上方的内容布局)。在android Q中,导航栏是半透明的并显示在应用程序内容之上
“问题”是 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
Run Code Online (Sandbox Code Playgroud)
并且不设置
android:fitsSystemWindows
android:windowTranslucentStatus
android:windowIsTranslucent
Run Code Online (Sandbox Code Playgroud)