我创建了一组在Android 4.4上完美运行的形状:
但是,当我在2.3上测试时:
底角被切换,并且它被压缩(这可能是高度问题)。
所以我决定创建一个像
drawable-v14
这样的文件夹,为不同的版本分配不同的形状,但我需要知道哪些Android版本有bug。我无法在所有版本上测试它!
修改
按钮编号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值存储在不同的资源文件中。
答案 0 :(得分:2)
好的,让我们从您的代码开始。 首先,您不需要为此设置图层列表。你可以这样做:
<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>
关于角落的问题,你是对的。已知错误https://code.google.com/p/android/issues/detail?id=9161。这个错误在android 3.1中修复了
正如@DerGolem所说,有黑客:
幸运的是,有一个解决方法:解决方法是放置 drawable-v12文件夹中的“正确”标记,以及相反的标记 在drawable文件夹中