相关疑难解决方法(0)

透明状态栏无法使用windowTranslucentNavigation ="false"

我正在开发一个Activity我需要使导航栏不透明的地方,状态栏在运行5.0+(API 21+)的设备上是透明的.我正在使用的样式如下,以及我的问题的解释.

AppTheme 扩展 Theme.AppCompat.Light.NoActionBar

<item name="android:statusBarColor">@color/transparent</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/welbe_red_transparent</item>
Run Code Online (Sandbox Code Playgroud)

FullscreenTheme 扩展 AppTheme

<item name="android:windowNoTitle">true</item>
<item name="android:statusBarColor">@color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
Run Code Online (Sandbox Code Playgroud)

这使得应用程序看起来像这样

机器人:windowTranslucentNavigation =

如果我删除android:windowTranslucentNavigation样式,或将其设置falseFullscreen,它修复了导航栏的问题.问题是状态栏变为完全白色而不是保持透明并显示其背后的内容.

机器人:windowTranslucentNavigation =

我已尝试fitsSystemWindow="true"在我的布局中使用,但它没有解决问题.任何人都知道为什么会这样吗?

android android-appcompat android-layout android-styles

38
推荐指数
2
解决办法
4万
查看次数