I use this codes for Android (Java) programming:
public static MessageBoxResult showOk(
Context context, String title, String message, String okMessa
You can set the positive, negative and neutral buttons, hide both the positive and neutral buttons, and put the negative button where the neutral button is supposed to be(center) by using LayoutParams.
in onCreateView:
dialog = builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setPositiveButton(R.string.go_on, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setNeutralButton(R.string.do_nothing, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.create();
in onStart():
super.onStart();
final Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setVisibility(View.INVISIBLE);
final Button neutralButton = dialog.getButton(AlertDialog.BUTTON_NEUTRAL);
neutralButton.setVisibility(View.INVISIBLE);
final Button negativeButton = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
negativeButton.setLayoutParams(neutralButton.getLayoutParams());