How to change the Text color of Menu item in Android? How to change the Text color of Menu item in Android? android android

How to change the Text color of Menu item in Android?


One simple line in your theme :)

<item name="android:actionMenuTextColor">@color/your_color</item>


It seems that an

  <item name="android:itemTextAppearance">@style/myCustomMenuTextAppearance</item>

in my theme and

   <style name="myCustomMenuTextAppearance" parent="@android:style/TextAppearance.Widget.IconMenu.Item">        <item name="android:textColor">@android:color/primary_text_dark</item>    </style>

in styles.xml change the style of list-items but not menu items.


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

@Overridepublic 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);}