0

I have a phone test device and I am having trouble with the ui of the buttons of it.

This code is fine with other devices but the alignment of the button isn't good in the said device above.

I tried doing all these but none worked. align AlertDialog buttons to center

I also tried putting additional buttons and setting it to invisible but I only want to use it if I really can't find a better solution.

Here is my code:

progressDialog.setCancelable(true);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setIndeterminate(false);
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, activity.getString(ResourceUtils.getResourceId(activity, "lbl_cancel", ResourceType.STRING)), this);
progressDialog.setOnCancelListener(this);
progressDialog.show();

Here is the picture of the Button alignment

kinowps
  • 19
  • 8

1 Answers1

0

Try as follows

progressDialog.getWindow().setGravity(Gravity.CENTER);
Farid Haq
  • 3,728
  • 1
  • 21
  • 15