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

Asked

Viewed 185 times

1

For layouts, Buttons and Edittexts I use the class ShapeDrawable more specifically the RoundRectShape and it works perfectly, but for Dialogs and Listviews it doesn’t work. Does anyone know what to use to make Dialogs and Listviews border or more specifically rounded corners? Thank you in advance. If that’s even possible.

  • Without using any xml ? That answer: http://stackoverflow.com/questions/12501488/android-alertdialog-with-rounded-corners

  • You have some kind of restriction that prevents you from using xml?

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;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.