Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here the codes for AlertDialog with a builder</p> <pre><code> AlertDialog.Builder builder = new AlertDialog.Builder(Setup.this); builder.setMessage("Message", 1)) .setPositiveButton(getString(R.string.browseonlinesupport), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { }) .setNeutralButton(getString(R.string.submit_help_request), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { } }) .setNegativeButton(getString(R.string.cancel), null) // to make the button even widths //.show() ; // } AlertDialog helpDialog = builder.create(); helpDialog.show(); // call show() must from dialog not builder, otherwise button not created and getButton is null LinearLayout.LayoutParams btParams; Button btPositive = helpDialog.getButton(AlertDialog.BUTTON_POSITIVE); btParams = (LinearLayout.LayoutParams) btPositive.getLayoutParams(); btParams.weight = 1; btParams.width = btParams.MATCH_PARENT; Button btNegative = helpDialog.getButton(AlertDialog.BUTTON_NEGATIVE); btParams = (LinearLayout.LayoutParams) btNegative.getLayoutParams(); btParams.weight = 1; btParams.width = btParams.MATCH_PARENT; Button btNeutral = helpDialog.getButton(AlertDialog.BUTTON_NEUTRAL); btParams = (LinearLayout.LayoutParams) btNeutral.getLayoutParams(); btParams.weight = 1; btParams.width = btParams.MATCH_PARENT; </code></pre> <p>*, call show() must from dialog not builder, otherwise button not created and getButton is null </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload