Changing textColor in theme is not applied in layout - Android

27 views Asked by At

I wanted to use Material.DayNight to implement Night mode on my app. However, changing the text color in my styles.xml (both not night and night) does not reflect on the layout file.

styles.xml

<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/light_theme_blue</item>
    <item name="colorSecondary">@android:color/white</item>
    <item name="android:textSize">@dimen/_13ssp</item>
    <item name="colorOnPrimary">@android:color/white</item>
    <item name="android:colorBackground">@color/light_theme_blue</item>
    <item name="android:colorForeground">@android:color/white</item>
    <item name="android:color">@android:color/white</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="colorOnSurface">@android:color/white</item>
    <item name="colorOnSecondary">@android:color/white</item>
    <item name="colorOnContainer">@android:color/white</item>
</style>

current_forecast_fragment.xml

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
    android:id="@+id/swipe_to_refresh_layout"
    android:layout_width="match_parent"
    android:theme="@style/AppTheme"
    android:layout_height="match_parent">

Image of the layout file:

Current Forecast Layout Screenshot

enter image description here

I've tried forcing all the OnPrimary, OnSurface, OnForeground values hoping at least on of them would work; but none of them did.

0

There are 0 answers