mardi 2 août 2016

How to center text in Alert Dialog Builder?

I'm trying to center some text in a default Alert Dialog Builder Here's my code so far, but it defaults to the left.

            new AlertDialog.Builder(getActivity())
                    .setTitle("Well done!")
                    .setMessage("Message centered????")

                    .setPositiveButton("OK",
                            new DialogInterface.OnClickListener() {

                                @Override
                                public void onClick(DialogInterface dialog,
                                        int which) {
                                    // TODO Auto-generated method stub

                                }
                            })

                    .setIcon(R.drawable.img_ok)
                    .show();

        }

Aucun commentaire:

Enregistrer un commentaire