Actually, the βcorrectβ answer is incorrect here. Turns out you can set maximum lines to more than 2 in AlertDialog. Here is an example:
AlertDialog closePlayerDialog; ......... Builder builder = new AlertDialog.Builder(this); builder.setMessage(getString(R.string.AskToClosePlayer)) .setPositiveButton(R.string.Yes, dialogClickListener) .setNeutralButton(R.string.NoJustCloseApp, dialogClickListener) .setNegativeButton(R.string.NoContinue, dialogClickListener); closePlayerDialog = builder.create(); closePlayerDialog.setOnShowListener(new DialogInterface.OnShowListener() { public void onShow(DialogInterface dialog) { float textSize = 12.0f; Button positive = closePlayerDialog.getButton(AlertDialog.BUTTON_POSITIVE); positive.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); positive.setMaxLines(3); Button neutral = closePlayerDialog.getButton(AlertDialog.BUTTON_NEUTRAL); neutral.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); neutral.setMaxLines(3); Button negative = closePlayerDialog.getButton(AlertDialog.BUTTON_NEGATIVE); negative.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); negative.setMaxLines(3); } }); closePlayerDialog.setCancelable(false); closePlayerDialog.show();
You basically edit the AlertDialog onShow components using DialogInterface.onShowListener .
Radu
source share