5

I want to change white color of text to orange.

Here is a example.

ActionBarSherlock

Bishan
  • 15,211
  • 52
  • 164
  • 258
Paulo Blasterx
  • 101
  • 2
  • 5

2 Answers2

3

This can be done through setting some styles for your action bar. It is explained in this blog post http://android-developers.blogspot.com.au/2011/04/customizing-action-bar.html

You need to set this in your style for you app.

<style name="MyTheme" parent="android:style/Theme.Holo.Light">
     <item name="android:dropDownListViewStyle">@style/MyDropDownListView</item>
</style>

Then you can specify this style with your own text color.

<!-- style the items within the overflow menu -->
<style name="MyDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown">
    <!-- This is the orange text color -->
    <item name="android:textColor">#CC3232</item>
</style>
Cassie
  • 5,223
  • 3
  • 22
  • 34
  • 4
    Well this does actually not work for me. A DropDown Item here has only background selectors. – redestructa Aug 28 '13 at 12:04
  • Works for me! I'm actually developing in Xamarin Android and I have been looking everywhere for this solution. After countless google searching I finally stumbled on this and tried it and it worked like a charm. You dont know how good it feels for that submenu to finally turn blue haha. – TeamChillshot Feb 20 '14 at 03:40
1

You can change the color of the MenuItem text easily by using SpannableString instead of String.

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.your_menu, menu);

    int positionOfMenuItem = 0; // or whatever...
    MenuItem item = menu.getItem(positionOfMenuItem);
    SpannableString s = new SpannableString("My red MenuItem");
    s.setSpan(new ForegroundColorSpan(Color.RED), 0, s.length(), 0);
    item.setTitle(s);
}
Habizzle
  • 2,971
  • 3
  • 20
  • 23