in

ThemeOverlay is not styling statusBar in one fragment


I want to change status bar color for dark blue for only one screen. I’m using ThemeOverlay for this and in fragment XML I set the theme. Why it doesn’t work like that?

themes.xml:

resources xmlns:tools="http://schemas.android.com/tools">

    <!-- Base application theme. -->
    <style name="Theme.Locals" parent="Theme.MaterialComponents.DayNight.NoActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/blue_800</item>
        <item name="colorPrimaryVariant">@color/blue_900</item>
        <item name="colorOnPrimary">@color/white</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_700</item>
        <item name="colorOnSecondary">@color/black</item>

        <item name="android:colorBackground">@color/background_100</item>

        <!-- Status bar style. -->
        <item name="android:statusBarColor" tools:targetApi="l">@color/background_100</item>
        <item name="android:windowLightStatusBar">true</item>

        <!-- Styles -->
        <item name="textInputStyle">@style/Widget.Locals.TextInputLayout.OutLined</item>
        <item name="buttonStyle">@style/Widget.Locals.Button</item>
        
    </style>
    
    <style name="ThemeOverlay.Locals.Explore" parent="">
        <item name="android:statusBarColor" tools:targetApi="l">@color/blue_900</item>
        <item name="android:windowLightStatusBar">false</item>
    </style>
    
</resources>

fragment_explore.xml:

<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:theme="@style/ThemeOverlay.Locals.Explore"
    tools:context=".presentation.explore.ExploreFragment">
...
</androidx.coordinatorlayout.widget.CoordinatorLayout>



Source: https://stackoverflow.com/questions/70606456/themeoverlay-is-not-styling-statusbar-in-one-fragment

A Python Script to convert Normal PNG Image to Apple iDOT PNG Image

LicenseBox v1.5.2 – PHP Licenser and Updates Manager – ULC