how can I change the text color of the ActionBar? I've inherited the Holo Light Theme, I'm able to change the background of the ActionBar but I don't find out what is the attribute to tweak to change the text color.
Ok, I'm able to change the text color with the attribute android:textColorPrimary but it also changes the text color of the dropdown menu displayed when an overflow happen on the ActionBar buttons. Any idea how to change the color of those dropdown menu / List ?
Try a lot of methods, in the low version of the API,a feasible method is
<item name="actionMenuTextColor">@color/your_color</item>
and don't use the Android namespace,hope can help youps:
This is the solution I used after checking all answers
Change the required colors it will work
It's an old topic but for future readers, using ToolBar makes everything very easy:
Add it to the root of the action bar. I had this problem.
actionMenuTextColor - changes text color for the action bar text, it never worked when it was part of the
Widget.Styled.ActionBar
, so I had to add it to the root. Other 2 attributes change title and subtitle of an action bar.A nice solution is to user a SpannableStringBuilder and set the color that way. You can even use different colors on different parts of the string, add images etc.
Tested with the new support library.
See Android: Coloring part of a string using TextView.setText()?
I found a way that works well with any flavor of
ActionBar
(Sherlock, Compat, and Native):Just use html to set the title, and specify the text color. For example, to set the ActionBar text color to red, simply do this:
You can also use the red hex code
#FF0000
instead of the wordred
. If you are having trouble with this, see Android Html.fromHtml(String) doesn't work for <font color='#'>text</font>.Additionally, if you want to use a color resource, this code can be used to get the correct HEX String, and removing the alpha if needed (the font tag does not support alpha):