Ad

Resources Style Item Name "android:blablabla" RED Highlighted, NOT WORKING, NO ERROR

Iam rather new android studio. I would like to test out some code to apply dark mode. However, I got problem with resources style. Not only to apply this dark mode, but also whenever i tried to do following like:

<style name"myStyle" parent="Base.blablabla">
    <item  name="android:blablabla">"@"</item>
</style>

the name in item tag which is "android:someLibrary" always highlited with RED color, and when i run the app, the style not working (but NO ERROR).

i dont have any idea how to fix

my full styles.xml file:

<resources>

<!-- Base application theme. -->
<!-- Light/Day Mode application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimaryLightMode</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDarkLightMode</item>
    <item name="colorAccent">@color/colorAccentLightMode</item>
    <item name="backgroundcolor">@color/backgroundcolorLightMode</item>
    <item name="cardbackground">@color/cardbackgroundLightMode</item>
    <item name="textcolor">@color/textbackgroundLightMode</item>
    <item name="tintcolor">@color/tintcolorLightMode</item>
    <item name="buttoncolor">@color/buttoncolorLightMode</item>
    <item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
</style>

<!-- Base application theme. -->
<!-- Dark/Night Mode application theme. -->
<style name="DarkAppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimaryDarkMode</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDarkDarkMode</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="backgroundcolor">@color/backgroundcolorDarkMode</item>
    <item name="cardbackground">@color/cardbackgroundDarkMode</item>
    <item name="textcolor">@color/tintcolorDarkMode</item>
    <item name="tintcolor">@color/tintcolorDarkMode</item>
    <item name="buttoncolor">@color/colorAccent</item>
    <item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
</style>

<style name="WindowAnimationTransition">
    <item name="android:windowEnterAnimation">@android:anim/fade_in</item>
    <item name="android:windowExitAnimation">@android:anim/fade_out</item>
</style>
</resources>

build.gradle (PROJECT)build.gradle PROJECT

build.gradle (APP)build.gradle APP

styles.xmlenter image description here

Ad

Answer

I've tested it in my current project and it builds fine. The only major difference i can see is i have upgraded gradle to 3.4.0, worth trying. I also find with XML invalidating and restarting tends to fix it.

File > Invalidate Caches and Restart

Ad
source: stackoverflow.com
Ad