1

For some reason it can't recognise textColor property.

Here's the code i used:

<resources>

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item>
</style>

<style name="AppTheme.ActionBarStyle" parent="Theme.AppCompat.Light">
    <item name="titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>
    <item name="background">@color/DarkSlateGray</item>
</style>

<style name="AppTheme.ActionBar.TitleTextStyle" parent="Theme.AppCompat.Light">
    <item name="textColor">@color/White</item>
</style>
</resources>

Error:(14, 21) No resource found that matches the given name: attr 'textColor'.

André Freitas
  • 273
  • 1
  • 6
  • 17
  • set parent to parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" instead of parent="Theme.AppCompat.Light" hope that works – Shubham AgaRwal Dec 12 '15 at 14:08
  • @Shubham Doesn't work. Gives me the same error. – André Freitas Dec 12 '15 at 14:16
  • if your are using toolbar as actionbar this link will help you http://stackoverflow.com/questions/26852108/how-do-you-set-the-title-color-for-the-new-toolbar – VIjay J Dec 12 '15 at 14:22
  • Did you tried giving color as html code, `#d1cbf5` – Ganesh Dec 12 '15 at 14:28
  • Check whether my answer solve your problem... @abff – Ganesh Dec 12 '15 at 14:34
  • You will find your answer on this link: Its a duplicate post[enter link description here](http://stackoverflow.com/questions/9920277/how-to-change-action-bar-title-color-in-code) – Sophia Dec 12 '15 at 14:43
  • @MobilityNewTech It's not dublicate. The link which you gave is actually about giving text color for Action Bar **Programatically** . What he asks is different. – Ganesh Dec 12 '15 at 14:49
  • 1
    Possible duplicate of [How do I change the background color of the ActionBar of an ActionBarActivity using XML?](http://stackoverflow.com/questions/8024706/how-do-i-change-the-background-color-of-the-actionbar-of-an-actionbaractivity-us) – Raza Ali Poonja Dec 12 '15 at 15:05
  • My question is duplicated. The answer is here: http://stackoverflow.com/a/26871541/3140594 – André Freitas Dec 12 '15 at 18:06

2 Answers2

1

I hope this will help you,

Use this

<item name="android:textColor">@color/White</item>

instead of this

 <item name="textColor">@color/White</item>
Ganesh
  • 1,820
  • 2
  • 20
  • 40
0

Duplicate question:

This link will help you through java class How to change action bar title color in code

From style use this How do I change the background color of the ActionBar of an ActionBarActivity using XML?

@Ganesh

Its mentioned in @rnoway answer

     <style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
       <item name="android:textColor">@color/red</item>
   </style>
Community
  • 1
  • 1
Sophia
  • 1,046
  • 1
  • 12
  • 15
  • Answer only if you are going to provide answer for question. Don't use for saying duplicate or mention some other person. Use Comment option if you want to say anything other than answer. – Ganesh Dec 12 '15 at 16:04
  • @MobilityNewTech Doesn't give any error but doesn't show any text. The topic is similar but the context is different from other questions posted previously – André Freitas Dec 12 '15 at 16:39
  • @MobilityNewTech I tried programmatically but still doesn't show anything. – André Freitas Dec 12 '15 at 16:48
  • @abff you didn't checked my answer? I am sure it would work. Give it a try and say what happened in comment. – Ganesh Dec 12 '15 at 17:49
  • @Ganesh My question is duplicated. The answer is here: http://stackoverflow.com/questions/26870698/change-actionbar-title-text-color-using-light-darkactionbar-theme-in-appcompat-2 – André Freitas Dec 12 '15 at 17:53