Try using
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
Frage
I've got the dialog below that shows up on my app... As you can see I have the rounded corners i want but i want to remove the black for transparent edges.
Here is the style xml and image of the dialog:
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android" android:insetBottom="-1dp">
<shape android:shape="rectangle">
<solid android:color="@color/base" />
<corners android:topLeftRadius="20dp"
android:topRightRadius="20dp"
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp" />
<stroke android:color="#7F7F7F"
android:width="1dp" />
</shape>
</inset>
Lösung
Try using
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
Andere Tipps
Or even simpler if you already use a custom theme for your dialog. Like below (only the necessary item is shown):
<style name="NoBlackDefaultBackground" parent="@android:style/android:Theme">
<item name="android:windowBackground">@drawable/transparent_background</item>
</style>
Where you create a a custom 9 patch transparent_background.png