Alex Rivera | Logout

Custom dialog on Android: How can I center its title?

Asked 2010-10-26T16:11:26.373
72

I'm developing an Android application.

How can I center the title for a custom dialog that I'm using?

Edit
Report

2 Answers

1

If you don't call AlertDialog.Builder.setIcon() and AlertDialog.Builder.setTitle(), then your custom dialog will not show the built-in/default title View. In this case you are able to add your custom title View:

AlertDialog.Builder.setView(View view)

As soon as it is you who create this View it is possible to implement any type of alignment.

answered 2010-10-26T18:08:09.123
0

You've got some starting tips here for modifying the title of a dialog: Android - change custom title view at run time Don't know if it can be centered(haven't tried), but if it's a custom View I guess it's very possible.

answered 2010-10-26T16:36:41.377

Your Answer