android - How to set margins to a custom dialog? - Stack Overflow

PHOTO EMBED

Sat Jul 03 2021 08:25:15 GMT+0000 (Coordinated Universal Time)

Saved by @swalia

AlertDialog.Builder builder = new AlertDialog.Builder(context);
...
...
AlertDialog dialog = builder.create();

ColorDrawable back = new ColorDrawable(Color.TRANSPARENT);
InsetDrawable inset = new InsetDrawable(back, 20);
dialog.getWindow().setBackgroundDrawable(inset);

dialog.show();
content_copyCOPY

https://stackoverflow.com/questions/6153489/how-to-set-margins-to-a-custom-dialog