Java – How do I set the ActionBar flag to TextView?

How do I set the ActionBar flag to TextView?… here is a solution to the problem.

How do I set the ActionBar flag to TextView?

I’ve been trying to make the ActionBar logo or up button text instead of an image. actionbar.setLogo(); Only drawable resources are accepted. Using an TextView extended layout did not serve the purpose.

Basically, what I want to accomplish is:

enter image description here

The first is from the new DeskClock app for Android 4.2, and the second is from the Contacts app. I checked the code in GitHub but couldn’t find anything.

Solution

Improvisation:

Option #1: Draw text on Bitmap Supported Canvas (TextView or draw directly) and then provide BitmapDrawable to setLogo().

Option #2: Hide icons and logos and use Get caret images and setCustomView() text.

Related Problems and Solutions