android: shape corners do not work when setting individual corners

It seems to be a known issue. Every corner must be >1 or else no corners will be rounded. According to the Android documentation it can be done but it's kind of hacky:

Note: Every corner must (initially) be provided a corner radius greater than 1, or else no corners are rounded. If you want specific corners to not be rounded, a work-around is to use android:radius to set a default corner radius greater than 1, but then override each and every corner with the values you really want, providing zero ("0dp") where you don't want >rounded corners.

See here: http://developer.android.com/guide/topics/resources/drawable-resource.html#corners-element


Change this:

 <corners 
        android:bottomRightRadius="12dp" 
        android:bottomLeftRadius="12dp"
        android:topLeftRadius="0dp" 
        android:topRightRadius="0dp"/>

to this:

 <corners 
        android:radius="1dp"
        android:bottomRightRadius="12dp" 
        android:bottomLeftRadius="12dp"
        android:topLeftRadius="0dp" 
        android:topRightRadius="0dp"/>

and it should be working as expected.

Tags:

Android