Reputation: 37
details:
error: style attribute 'attr/colorTextGreen (aka com.example.a92317.ltka:attr/colorTextGreen)' not found. Message{kind=ERROR, text=error: style attribute 'attr/colorTextGreen (aka com.example.a92317.ltka:attr/colorTextGreen)' not found., sources=[C:\Users\92317.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\42626cc3773e81f375f5215b1d4a6d01\res\values\values.xml:391:5-397:13], original message=, tool name=Optional.of(AAPT)}
colors.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="colorTextGreen">#006600</color>
<color name="colorBackgroundGreen">#F0F8FF</color>
<color name="colorTransparent">#00000000</color>
</resources>
styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorTextGreen">@color/colorTextGreen</item>
<item name="colorBackgroundGreen">@color/colorBackgroundGreen</item>
<item name="colorTransparent">@color/colorTransparent</item>
</style>
<style name="FontStyle" parent="AppTheme">
<item name="android:fontFamily">@font/newfont</item>
</style>
</resources>
How could I do to solve it? I'm dying...
Upvotes: 2
Views: 1755
Reputation: 2717
following is not a valid item name
<item name="colorTextGreen">@color/colorTextGreen</item>
you can only use item names that specify an attribute in your xml layout. The value in the element is the value for that attribute.
example
<item name="android:background">@color/colorTextGreen</item>
this will be default background color because we set the item name to color for theme.
Upvotes: 2
Reputation: 2785
You can't create item
s with you own name, in this case you created a colorTextGreen
and a colorBackgroundGreen
, this is no possible. The item
has predefined name, so, you must just use it passing a value.
Upvotes: 0