Does anybody knows how can I set margins to a custom dialog? I\'m asking because I\'ve a custom dialog but when displayed it stretches to fill the parent, even though I set
I was having trouble with the other solutions presented as the "OK" and "CANCEL" buttons went outside of the screen and it just looked weird. Instead, I used android:windowMinWidthMinor & android:windowMinWidthMajor which looked better and incidentally also required less code. Nothing is needed in Java / Kotlin.
Here's all I did:
1) Only use only one background drawable (I called mine dialog_box.xml)
2) Set background in Layout:
3) Set style:
- @style/AlertDialogTheme