How to leave a Dialog with rounded edges (edges) via code without using xml?

1

For layouts, buttons and EditTexts I use the ShapeDrawable class more specifically the RoundRectShape and it works perfectly, however for Dialogs and ListViews this does not work. Does anyone know what to use to leave Dialogs and ListViews with borders or more specifically rounded corners? Thanks in advance. If that's possible.

    
asked by anonymous 24.11.2015 / 13:51

1 answer

0

Try this:

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog =  super.onCreateDialog(savedInstanceState);   
    dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    return dialog;
}
    
24.11.2015 / 20:54