exception exception - 1 month ago 15
Android Question

How to align center the title or label in activity?

I know there are two ways of setting the title of activity. One way is the setting it in the android manifest like this android:label="@string/app_name". Second is programmatically setting in activity class like setTitle("Hello World!"). Both ways are positioned in the left side but how can I put it in the center?

Answer

You will need to define a custom title style/theme. Look in the samples for com.example.android.apis.app.CustomTitle.

Comments