I am trying to get a shape as shown in figure, a rectangle with corners completely round:
But it seems I can't get corners "rounder" than in this figure:
Why is that? there is a max value for <corners android:radius="integer" />
?
Of course I could do that with a png, but I suppose using a shape is more efficient, so I would prefer that.
My code:
<Button
android:id="@+id/button_guest"
android:layout_width="315dp"
android:layout_height="80dp"
android:background="@drawable/rounded_rectangle"
android:contentDescription="@string/text_button_guest"
android:onClick="startGuestMode"
android:text="@string/text_button_normal"
android:textAllCaps="false"
android:textColor="#ff000000"
android:textSize="50sp"
android:layout_marginLeft="125dp"
android:layout_marginStart="125dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
rounded_rectangle.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<corners
android:radius="40dp" />
</shape>
Ok, I love when I scratch my head for hours, then I end up asking a question here, and then I find an answer by myself in less than 10 minutes :D
The solution is in my code below. You would think it should have the same behaviour, but apparently it has not. Probably another bug about rounded corners.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<corners
android:bottomLeftRadius="40dp"
android:bottomRightRadius="40dp"
android:topRightRadius="40dp"
android:topLeftRadius="40dp"
/>
</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