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?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Sure, you can use
Dialog.setContentView()
to set the content of a dialog to be an arbitrary layout.Make yourself a layout file with a Vertical LinearLayout that has the buttons you want in it and call
setContentView()
on your dialog, passing the name of your layout file.If you are deadset on
AlertDialog
you can do something similar withbuilder.setView()
There has been a setItems() call which does this since API level 1. No reason to create a custom dialog unless you want to change the look and feel of the items.