Jacopo Grassi Jacopo Grassi - 3 months ago 17
Android Question

Android - Change Actionbar Title Text Color

I'm developing an app and I want to

change the textcolor of the actionbar title
. now, I defined a theme in my manifest:

<application
android:theme="@style/AppTheme">
</application>


which is defined in styles.xml:

<style name="AppTheme" parent="android:style/Theme.Holo.Light">
<item name="android:textViewStyle">@style/AppTheme.TextView</item>
<item name="android:actionBarStyle">@style/AppTheme.ActionBarStyle</item>
</style>

<style name="AppTheme.ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>
</style>

<style name="AppTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/themeapp</item>
</style>

<style name="AppTheme.TextView" parent="@android:style/Widget.TextView">
<item name="android:textColor">#FFFFFF</item>
</style>


this doesn't work but I don't get why. this should work according to this answer.neither the textview style is working.

what I am doing wrong?

UPDATE:
changed to meet Grace Feng answer below

Answer

wandering around StackOverflow I found this answer which finally worked.

I report it here:

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/ActionBar</item>
    ...
</style>

<style name="ActionBar" parent="@android:style/Widget.ActionBar">
  <item name="android:titleTextStyle">@style/ActionBar.Title</item>
  <item name="android:subtitleTextStyle">@style/ActionBar.Subtitle</item>
  ...
</style>

<style name="ActionBar.Title">
  <item name="android:textColor">@color/my_color</item>
</style>

<style name="ActionBar.Subtitle">
  <item name="android:textColor">@color/my_color</item>
</style>