Custom Title Bar in ANDROID

By | March 29, 2012

Hi all….

Today in this post I will show you how to give a custom layout for the titleBar in ANDROID.
You can place almost anything inside a title using your custom layout.

Now go on and create a fresh project and copy this code into the main java file

package pack.coderzheaven;

import android.os.Bundle;
import android.view.Window;
import android.widget.ProgressBar;
import android.widget.TextView;

public class CustomTitleDemo extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        Boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

        if (customTitleSupported) {
            TextView tv = (TextView) findViewById(;

            ProgressBar titleProgressBar = (ProgressBar) findViewById(;

Now create a new xml file and name it custom_title.xml and copy the following code to it.



Note: remember to have images mentioned here in the drawable folder.

Now the strings.xml file where the color is defined.

Hello World, Custom Title Bar from CoderzHeaven#ffffff#000000#2554C7#347C2C#ff9900#FF00FF#a020f0#778899#C11B17#FFFF8C#b0e0e6#2F1700#7D2252

Atlast the AndroidManifest.xml file.

Custom TitleBar in ANDROID

Custom TitleBar in ANDROID

Please leave your valuable comments if you found this post useful………

Leave a Reply

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