Can we have vertical buttons in an Android alert dialog?
问题 By default, we get two or three buttons that are horizontally aligned in an alert dialog. Is it possible to have them vertically aligned within the alert dialog? 回答1: Sure, you can use Dialog.setContentView() to set the content of a dialog to be an arbitrary layout. Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.yourLayoutId); dialog.show(); Make yourself a layout file with a Vertical LinearLayout that has the buttons you want in it and call setContentView() on your dialog,