I am trying to display an lengthy message in Default AlertDialog with following code.
public static void showAlert(String message, Context con) {
AlertDialog.Builder dialog = new AlertDialog.Builder(con);
dialog.setTitle(message);
dialog.setPositiveButton(" OK ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
dialog.show();
}
But when I pass long message Alert Dialog does not display full message. Can I align text of Dialog by center. I dont want to use Custom Dialog.
try following code
Change
to
and if you want to center align the text, you'll have to create a textview like in the following example:
taken from: Center message in android dialog box