admin管理员组文章数量:1287147
I have followed all tutorials and cannot get my statusbar to change color despite having set all attributes:
<resources xmlns:tools=";>
<!-- Base application theme. -->
<style name="Theme.FestiLab" parent="Theme.Material3.DayNight">
<!-- Primary brand color. -->
<item name="colorPrimary">#293859</item>
<item name="colorPrimaryVariant">#293859</item>
<item name="colorOnPrimary">#FFFFFF</item>
<item name="android:statusBarColor">#293859</item>
<item name="colorSecondaryVariant">#293859</item>
<item name="colorSecondary">#293859</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="toolbarStyle">@style/Theme.Custom.Toolbar</item>
</style>
<style name="Theme.Custom.Toolbar" parent="Widget.Material3.Toolbar">
<item name="android:background">#293859</item>
</style>
</resources>
I doubled checked, an,d no code override opr whatsoever
My manifest is also correct as if I change other settings from theme.xml, they are reflected.
I feel really stupid there.. Thanks fior any help µ EDSIT: I also tried with Theme.MaterialComponents.DayNight.DarkActionBar
I have followed all tutorials and cannot get my statusbar to change color despite having set all attributes:
<resources xmlns:tools="http://schemas.android/tools">
<!-- Base application theme. -->
<style name="Theme.FestiLab" parent="Theme.Material3.DayNight">
<!-- Primary brand color. -->
<item name="colorPrimary">#293859</item>
<item name="colorPrimaryVariant">#293859</item>
<item name="colorOnPrimary">#FFFFFF</item>
<item name="android:statusBarColor">#293859</item>
<item name="colorSecondaryVariant">#293859</item>
<item name="colorSecondary">#293859</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="toolbarStyle">@style/Theme.Custom.Toolbar</item>
</style>
<style name="Theme.Custom.Toolbar" parent="Widget.Material3.Toolbar">
<item name="android:background">#293859</item>
</style>
</resources>
I doubled checked, an,d no code override opr whatsoever
My manifest is also correct as if I change other settings from theme.xml, they are reflected.
I feel really stupid there.. Thanks fior any help µ EDSIT: I also tried with Theme.MaterialComponents.DayNight.DarkActionBar
Share Improve this question asked Feb 24 at 11:21 Waza_BeWaza_Be 39.6k50 gold badges191 silver badges262 bronze badges 5 |1 Answer
Reset to default 1This is most likely caused by the Edge-to-edge enforcement introduced in Android 15 (API level 35) which enforces a transparent background for the system status and navigation bar.
In the transition period until you can fully adapt your app to properly work edge-to-edge you can opt-out of the enforcement using windowOptOutEdgeToEdgeEnforcement. This will only work when targeting API level 35, though. It is deprecated in API level 36 and won't have an effect anymore.
本文标签: androidThe status bar does not change colorStack Overflow
版权声明:本文标题:android - The status bar does not change color - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741273956a2369619.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
windowOptOutEdgeToEdgeEnforcement
is only temporary and wont work in later versions so you might as well just support the transparent status bar correctly – tyczj Commented Feb 24 at 13:19