Pregunta

I have created a set of shapes which work perfectly on Android 4.4: enter image description here However, when I tested it on 2.3: enter image description here The bottom corners are switched, and it is condensed (which is probably a height problem). So I decided to create a folder like drawable-v14 and assign different shapes for different versions, but I need to know which Android versions have there bugs. I could not test it on all versions!

EDIT
The shape for Button number 7:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <shape android:shape="rectangle">

            <solid android:color="@color/rounded_stroke_color" />

            <corners
                android:topLeftRadius="0dp"
                android:topRightRadius="0dp"
                android:bottomLeftRadius="@dimen/rounded_radius_default"
                android:bottomRightRadius="0dp" />

        </shape>
    </item>
    <item
        android:top="@dimen/rounded_stroke_normal_half"
        android:bottom="@dimen/rounded_stroke_normal"
        android:left="@dimen/rounded_stroke_normal"
        android:right="@dimen/rounded_stroke_normal_half">
        <shape android:shape="rectangle">

            <solid android:color="@color/rounded_fill_color" />

            <corners
                android:topLeftRadius="0dp"
                android:topRightRadius="0dp"
                android:bottomLeftRadius="@dimen/rounded_radius_default"
                android:bottomRightRadius="0dp" />

            <padding
                android:left="@dimen/rounded_padding_left"
                android:right="@dimen/rounded_padding_right" />

        </shape>
    </item>
</layer-list>

BTW the values are stored in a different resource file.

¿Fue útil?

Solución

Ok, let's start with your code. First of all, you don't need to have layer-list for that. You can do it like this:

<shape android:shape="rectangle">

            <solid android:color="@color/rounded_stroke_color" />
            <stroke android:color="@color/comments_dark_color" android:width="@dimen/stroke_width"/>
            <corners
                android:topLeftRadius="0dp"
                android:topRightRadius="0dp"
                android:bottomLeftRadius="@dimen/rounded_radius_default"
                android:bottomRightRadius="0dp" />

        </shape>

ABout problem with corners, you are right. It is known bug https://code.google.com/p/android/issues/detail?id=9161. This bug was fixed in android 3.1

As @DerGolem says, there is hack:

Lucky us, there is a workaround: the workaround is to put the "correct" drawbles in the drawable-v12 folder, and the reversed ones in the drawable folder

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top