Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how set to the CENTER title in AlertDialog? [duplicate]

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

I have code:

     return new AlertDialog.Builder(getActivity())

            .setTitle("Warning!")
            .setMessage("message!")
            .setPositiveButton("yes ",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {

etc... how .setTitle("Warning!") set to the CENTER?

like image 373
Mr_redpants Avatar asked Oct 09 '11 19:10

Mr_redpants


People also ask

How do I center the title of dialog alert in Android?

You cannot center the title in the default alert dialog. You will need to create a custom dialog in order to center the title.

How many buttons can be set up on an AlertDialog?

AlertDialog. A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout.

What is the difference between dialog and AlertDialog?

AlertDialog is a lightweight version of a Dialog. This is supposed to deal with INFORMATIVE matters only, That's the reason why complex interactions with the user are limited. Dialog on the other hand is able to do even more complex things .


1 Answers

You cannot center the title in the default alert dialog.

You will need to create a custom dialog in order to center the title.

The answers here describe how it can be done.

like image 156
Mike L. Avatar answered Oct 19 '22 11:10

Mike L.