1

I have followed all tutorials and cannot get my statusbar to change color despite having set all attributes:

<resources xmlns:tools="http://schemas.android.com/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

asked Feb 24, 2025 at 11:21
4
  • targetSdk = 35, compileSdk = 35, on a Pixel 8 with Android 15 Commented Feb 24, 2025 at 11:32
  • @tyg THANKS your comment helped me to Google it again with Android 5, and I found! <item name="android:windowOptOutEdgeToEdgeEnforcement">true</item> You can add it as an answer, I will gladly accept Commented Feb 24, 2025 at 11:33
  • 1
    This question is similar to: How to change the status bar color in Android 15+?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Feb 24, 2025 at 12:29
  • @Waza_Be that windowOptOutEdgeToEdgeEnforcement is only temporary and wont work in later versions so you might as well just support the transparent status bar correctly Commented Feb 24, 2025 at 13:19

1 Answer 1

1

This 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.

answered Feb 24, 2025 at 12:13
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.