Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : The rounded corners work different in different Android version

I have problem with the corners tag.

This is my shape file.

<stroke
    android:width="1dp"
    android:color="#ff999999" />

<size android:height="40dp" />

<gradient
    android:angle="90"
    android:centerColor="#f5f5f5"
    android:endColor="#fcfcfc"
    android:startColor="#efefef"
    android:type="linear" />

<corners
    android:bottomLeftRadius="0dip"
    android:bottomRightRadius="8dip"
    android:topLeftRadius="8dip"
    android:topRightRadius="0dip" />

But when I set it for view's background. It display different shape in Android 2.2 and Android 4.0.3 . When it is running on Android 4.0.3 :running on Android 4.0.3 And on Android 2.2 :Running on Android 2.2

Please see "ANNOUNCE" button. Do you know why ? And how can I fix it ? Please help me ! Sorry because my English is not really well.

like image 354
gZerone Avatar asked Jul 27 '12 16:07

gZerone


1 Answers

This was a bug in pre-API 12 versions of the SDK, where the bottom left and bottom right radii were reversed. What you can do (and there is a lot more information at this link) is create a res/drawable-v12 folder, and copy these drawables into it with the radii reversed (i.e. bottom left radius becomes bottom right radius, and vice versa), and these drawables will be selected automatically for devices above API 12.

like image 161
Kevin Coppock Avatar answered Nov 13 '22 14:11

Kevin Coppock