Android – Change Title bar Text and Image

By -

In Android, mostly we see the activity with normal title bar i.e. Activity name in Title bar but here i am going to present how do we change the title bar text and title bar image (Background image, icon with text).

From my point of view, there are 2 ways to change the title bar text:

    1. Normal way

    you can Change the Title of each screen (i.e. Activity) by setting their Android:label.

      Custom Title bar Text and Image

    But if you want to Customize title-bar in your way, i.e. Want to put Image icon and custom-text, then following code is running for me:



    public class TitleBar extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {

    final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);


    if ( customTitleSupported ) {
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar);

    final TextView myTitleText = (TextView) findViewById(;
    if ( myTitleText != null ) {
    myTitleText.setText(“NEW TITLE”);

    // user can also set color using “Color” and then “Color value constant”
    // myTitleText.setBackgroundColor(Color.GREEN);


    The strings.xml file is defined under the values folder.

    Hello World, Set_Text_TitleBar!


  • Paresh Mayani

    Lazy android developer, exploring the horizon of android development since 7 years, currently working as a Technical Lead - Android at Simform Solutions, India. Former Application Architect at KarConnect. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad

    Loading Facebook Comments ...
    Loading Disqus Comments ...