Of course, you can use Dialog.setContentView () to set the contents of the dialog box as 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 need, and call setContentView in your dialog box, passing the name of your layout file.
If you froze in AlertDialog, you can do something similar with builder.setView ()
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.yourLayoutId, (ViewGroup) findViewById(R.id.yourLayoutRoot)); AlertDialog.Builder builder = new AlertDialog.Builder(this) .setView(layout); AlertDialog alertDialog = builder.create(); alertDialog.show();
source share