Search code examples
androidandroid-manifestandroid-theme

Attributes are ignored in my app theme (style)


I have base theme

<style name="BaseAppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    <item name="colorPrimary">@color/color_primary</item>
    ...
</style>

and AppTheme that inherits it

<style name="AppTheme" parent="BaseAppTheme" >
    <item name="colorPrimary">#FFFF0000</item>
    <item name="android:statusBarColor">@color/transparent</item>
</style>

and is used as the main theme of the app, i.e.

<application
...
    android:theme="@style/AppTheme"
... 
    >
    <activity
        android:name=".MainActivity"
        android:theme="@style/AppTheme"/>
</application>

The problem is that attributes (eg <item name="colorPrimary">#FFFF0000</item> or <item name="android:statusBarColor">@color/transparent</item>, all of them) in AppTheme are ignored. However, if I add them to BaseAppTheme then they will work. Why are attributes ignored in AppTheme and how to fix it?


Solution

  • Do you have AppTheme only in values/styles.xml? Maybe do you have values-v21/styles.xml that contains AppTheme also so the problem is there or something like this?