Solution 1 :
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?
Problem :
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?
Comments
Comment posted by Rajnish Sharma
I tried the same and it is working fine! Try with some other color in statusBarColor! I tried with #C51D1D and works well!
Comment posted by Andriy D.
@IR42 Maybe you use the BaseAppTheme somewhere, e.g. in Try rebilding and clearing your cache, your problem might be from there! Can you show the manifest file if your problem still persists? if not then you can mark my answer correct! @AndriyD. i realized i added attrs to Yup. That was it. This is madness. You’d naturally think the suffixed versions inherit and overwrite from the non-suffixed one.Comment posted by Rajnish Sharma
Comment posted by Rajnish Sharma
Comment posted by IR42
Comment posted by Hiro