Creating a rectangle shape with only two rounded edges Creating a rectangle shape with only two rounded edges android android

Creating a rectangle shape with only two rounded edges


<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle" android:padding="10dp"><solid android:color="#FFFFFF"/><corners android:bottomRightRadius="0dp"android:bottomLeftRadius="0dp"android:topLeftRadius="15dp"android:topRightRadius="15dp"/></shape>

This code is just working (since?) Android version 2.2. Referring to the documentation, the code should look like the following:

<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle" android:padding="10dp"><solid android:color="#FFFFFF"/><corners android:radius="2dp"android:bottomRightRadius="0dp"android:bottomLeftRadius="0dp"android:topLeftRadius="15dp"android:topRightRadius="15dp"/></shape>


You might find this helpful.

<?xml version="1.0" encoding="utf-8"?><!--  res/drawable/rounded_edittext.xml --><shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle" android:padding="10dp"> <solid android:color="#FFFFFF"/>    <corners     android:bottomRightRadius="0dp"     android:bottomLeftRadius="0dp"  android:topLeftRadius="15dp"  android:topRightRadius="15dp"/></shape>


I changed the android:radius attribute to android:topRightRadius and android:topLeftRadius