1

I recently changed the ActionBarSherlock library to AppCompat-v7, and the text color of my textviews is a little bit more "light-gray".

I would like to change the default textColor attribute of the library, and here is what I did in my custom theme:

<style name="Theme.myCustom" parent="@style/Theme.AppCompat.Light">
    <item name="android:textColor">@color/textColor</item>
</style>

...where textColor is #000000 (black)

But nothing has changed in my app.

What is the best way to change the default texts color ?

psv
  • 3,147
  • 5
  • 32
  • 67
  • check: http://stackoverflow.com/questions/29912260/android-appcompat-22-1-1-default-text-color-and-actionmode-style – piotrek1543 Jan 06 '16 at 11:02
  • 1
    and: http://stackoverflow.com/questions/26870698/change-actionbar-title-text-color-using-light-darkactionbar-theme-in-appcompat-2 – piotrek1543 Jan 06 '16 at 11:03
  • Why are simple things in Android so impossibly complicated?!! This should just work out of the box.... – doctorram Nov 23 '17 at 00:45

1 Answers1

1

Please try android:textColorPrimary or android:textColorSecondary.

    <item name="android:textColorPrimary">@color/text_on_primary</item>
    <item name="android:textColorSecondary">@color/subtitle_on_primary</item>

Sorry probably you need this.

android:textColor="?android:attr/textColorPrimary"

EDITED

Please try to use TextAppearance.

<style name="Theme" parent="@android:style/Theme"> 
<item name="textAppearanceSmall">@style/MyTextAppearanceSmall</item> 
</style> 
<style name="MyTextAppearanceSmall" parent="@android:style/TextAppearance.Small"> 
<item name="android:textColor">?colorPrimary</item> 


</style>
takahirom
  • 1,934
  • 2
  • 12
  • 21
  • What is your activity theme? – takahirom Jan 05 '16 at 13:03
  • My activity does not have a real "theme" but by default it should take the theme from tag in the manifest which is "Theme.myCustom", which is itself inherited from @style/Theme.AppCompat.Light – psv Jan 05 '16 at 16:40
  • 1
    Thanks. Did You add `android:textColor="?android:attr/textColorPrimary" ` to TextView layout? – takahirom Jan 05 '16 at 16:46
  • I did not add this line because I really have a lot of textviews, I am sure I can override the default color without adding a line on each my textviews... – psv Jan 05 '16 at 16:56