1

I just want to do something that seems simple, change the color of a menu item title in the ActionBar.

I've seen that many people have the same problem, so I tested every solution that I found. Not even one worked!

Here is my code :

<style name="AppBaseTheme" parent="android:Theme.Light">
    ...
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    ...
</style>


<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@color/blanc</item>
    <item name="android:itemTextAppearance">@style/textAppearance</item>
</style>

<style name="textAppearance" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">#FFFFFF</item>
</style>

I want to change this : enter image description here

the number 2 and 3, which are not icons but text. Until now the color of the text is the same light grey you can see on the picture's icons above.

Obviously, there is something I do not get right. If you have any idea or suggestion, please tell me! Thanks!

2 Answers2

0

Just Use following code..

getSupportActionBar().setTitle(Html.fromHtml("<font color=\"red\">" + "Hello" + "</font>"));

Hope it Helps

Rajesh
  • 12,393
  • 4
  • 47
  • 76
  • I think this changes the color of the title of the actionbar. But I want to change the color of the menu items (on the right of the action bar). – Matthieu Lemonnier Oct 10 '14 at 08:58
0

if you want to change the colour of image you have to use the custom icon in menu->main.xml like this :

   <item
    android:id="@+id/action_refresh"
    android:icon="@drawable/ic_action_refresh"
    android:showAsAction="ifRoom|withText"
    android:title="@string/refresh"
    android:visible="false"
    hcpl:showAsAction="ifRoom"/>

here is the link from where you can find the action bar icons and modify action bar icons and from here you can modify modify action bar icon

Syed Raza Mehdi
  • 3,809
  • 1
  • 28
  • 45