I want to add top and bottom padding between each single choice item in an AlertDialog. I have attempted to achieve this goal with this style resource:
<style name="CustomDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:listChoiceIndicatorSingle">@null</item>
<item name="android:background">@drawable/radio_button_background_selector</item>
<item name="android:paddingTop">17dp</item>
<item name="android:paddingBottom">17dp</item>
</style>
Then the Activity code that uses this style is pretty straightforward:
AlertDialog.Builder(this, R.style.CustomDialog)
.setSingleChoiceItems(options, currentSelectedIndex) { dialog, index ->
if (index != currentSelectedIndex) {
// do something
}
dialog.dismiss()
}
.show()
The padding works as expected, except that it also adds a huge margin at the top and bottom of the DialogFragment.
How can I add padding between each single choice item without having this unintended consequence?


