How to change action bar title color in code
Solution 1:
The ActionBar
title ID is hidden, or in other words, it's internal and accessing it can't be done typically. You can reference it using Resources.getIdentifier
then View.findViewById
though.
Grab the ID for the action_bar_title
int titleId = getResources().getIdentifier("action_bar_title", "id", "android");
Now you can use the ID with a TextView
TextView abTitle = (TextView) findViewById(titleId);
abTitle.setTextColor(colorId);
Solution 2:
You can use a SpannableString and ForegroundColorSpan to set the colour of the title
Spannable text = new SpannableString(actionBar.getTitle());
text.setSpan(new ForegroundColorSpan(Color.BLUE), 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
actionBar.setTitle(text);