0

I had already had some issues with the overflow button being black and wanting it white but after some trial and error I got it working. But I just can't get this text button to be white. It's just a string based item in the main_toolbar.xml

<item
        android:id="@+id/more"
        android:title="@string/more"
        app:showAsAction="always"/>

Link to the image

After playing around for several hours in styles.xml and looking for solutions in here, I gave up and just decided to ask for my specific problem. Thanks in advance!

geefour
  • 3
  • 1
  • [link_actionbar](https://stackoverflow.com/questions/28352963/change-toolbar-menu-item-color-non-hidden-action?answertab=votes#tab-top) hope that can help you – Leo Mrko Mar 29 '20 at 02:28
  • Thank you very much for your comment but none of the answers there did it. – geefour Mar 29 '20 at 03:03

1 Answers1

0

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);
}
Shimaa Yasser
  • 587
  • 4
  • 12