I'm trying to make a dialog that appears as a rounded rectangle. I'm doing this by specifying the following shape xml as the background for the dialog layout.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF"/>
<corners android:radius="40dp"/>
<padding android:left="10dp"
android:right="10dp"
android:top="10dp"
android:bottom="10dp"/>
</shape>
The resulting dialog has rounded corners inside a black 90 degree rectangle. I want to know how I can get rid of the ninety degree rectangle that remains and show nothing but the rounded rectangle.
It seems like the rectangle template stays behind after I curve the corners:
Here's a link to a picture of the dialog my code's producing: http://img577.imageshack.us/img577/8292/photoon20110912at2032.jpg
Write your constructor as:
public CustomDialog(Context context, int theme) {
super(context, theme);
getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
}
Try this:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:shape="rectangle">
<solid android:color="#B7B7B7"/>
<corners android:bottomLeftRadius="8dip"
android:bottomRightRadius="8dip"
android:topLeftRadius="8dip"
android:topRightRadius="8dip"/>
</shape>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With