Changing text size and style in action bar


Like me , I guess many of us want to show a different size and styled text in action bar. If you are using ToolBar its fairly easy but for all those old projects that still have Android’s action bar its a pretty hard work. But you can achieve this with the help of CustomView. Yes you can add a CustomView to your action bar. Apply your style on this custom view and add it to the action bar.

So lets create an example, here I want my Action bar title with center gravity and textSize of 15sp.

And its done. But be careful as after this non of your setTitle() function will change the Title of your activity.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.


Webkul is a truly trusted and supported IT Company to develop business ideas for e-commerce. They provide professional support after deploying the solution to production and be responsible to act for fixing the reported issues or system errors. We highly encourage to deal with Webkul for business development.

Hussein Zawia

Hussein Zawia

Co-founder, 24Dokan

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home