AlertDialog.Builder quitDialog = new AlertDialog.Builder( ActivityFragments.this); quitDialog.setTitle("Выход: Вы уверены?"); quitDialog.setPositiveButton("Таки да!", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub finish(); } }); quitDialog.setNegativeButton("Нет", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); quitDialog.show(); 

This code places unevenly the buttons and text in the Dialog. How to fix it? enter image description here

  • This is a completely normal dialogue behavior. - post_zeew
  • @post_zeew how to make everything smooth? - Martinez Toni
  • @MartinezToni, stackoverflow.com/questions/29797134/… custom styles for an alert - Mikhail Rebrov
  • stackoverflow.com/questions/6131133/… here specifically with the alignment of the text in AlertDialog - Mikhail Rebrov
  • @Mikhailrebrov in my case is easier to replace the AlertDialog with Dialog with its own markup? - Martinez Toni

1 answer 1

What you see is a standard dialogue in Material style. The title is bold in the upper left, the buttons in the lower right. When using the standard dialog it will be displayed differently on different versions of the OS. If you need some specific markup or you want it to look the same on all versions of the OS - you need to create your own markup and display it in the dialog.

If you are satisfied with the appearance shown by you, then here is a great lib that displays the dialogues in the same way on all versions of the OS:

Material Dialogs