How to change action bar title color in code

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);

Leave a Comment