Tom
Tom

Reputation: 11

style attribute textColorPrimary not found

I'd like to change the color of the text in textColorPrimary attribute in styles.xml

<item name="textColorPrimary">#FFEB3B</item>

Error:error: style attribute 'attr/textColorPrimary (aka com.example.android.christmasgifts:attr/textColorPrimary)' not found.

Complete error below enter image description here

Upvotes: 1

Views: 9740

Answers (3)

Nasta
Nasta

Reputation: 937

I had the same trouble. Error:error: style attribute 'attr/textColorPrimary (aka ...../textColorPrimary)' not found.

Whole information, which is about design, is in values.xml.

I changed from textColorPrimary to android:textColorPrimary and it works now . :)

enter image description here

Upvotes: 11

ratanak pek
ratanak pek

Reputation: 1

Dalla95's answer is correct, but your case is not error but mine error. To address this, you should specify android: for textColorPrimary, please check code below:

<style name="ToolbarThemeDemo" parent="Theme.AppCompat.Light">
  <item name="android:textColorPrimary">@android:color/white</item>
  <item name="android:textColorSecondary">@android:color/white</item>
</style>

And for the Color not changing maybe you use it wrong. you should call your theme by :

app:theme="@style/ToolbarThemeDemo"

not below:

style="@style/ToolbarThemeDemo"

Upvotes: 0

dalla92
dalla92

Reputation: 442

I think it's missing the prefix android:

<item name="android:textColorPrimary">#FFEB3B</item>

Upvotes: 4

Related Questions