0

I want to develop a title bar in android like this

  1. Home Button - Left aligned
  2. Application Title - At the center
  3. Image Icon - Right Aligned

I am not sure how to do it. I am a new user and hence not allowed to post the image here. Sorry for inconvinience.

droid
  • 41
  • 5
  • possible duplicate of [Change title bar text in Android](http://stackoverflow.com/questions/3438276/change-title-bar-text-in-android) – PearsonArtPhoto Dec 18 '12 at 14:36

2 Answers2

1

To create a custom title bar, you need to do four things

  1. Set up a relative layout specifying TextView for left, center text, and a ImageView aligned in the centre.
  2. From the onCreate of the activity where the custom title is displayed, call requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
  3. Call setContentView as usual.
  4. Then you need to instruct that the layout of the custom title is to be put in place with the associated relative layout getWindow.setFeatureInt(Window.FEATURE_CUSTOMER_TITLE, R.layout.my_custom_title);

From there onwards, its a matter of obtaining the TextView and ImageView widgets via findViewById and calling the appropriate methods of the widget to suit the requirements.

t0mm13b
  • 34,087
  • 8
  • 78
  • 110
0

There are two way for the change the title bar

1) Normal way,

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

<activity android:name=".Hello_World"
     android:label="This is the Hello World Application">

2) if you want to Customize title-bar, i.e. you Want to put Image icon and custom-text, then following this LINK

Community
  • 1
  • 1
Rahul Patel
  • 3,823
  • 5
  • 30
  • 46