Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android 2.1 xml绘图工具中的bug?_Android_Xml_Drawable - Fatal编程技术网

android 2.1 xml绘图工具中的bug?

android 2.1 xml绘图工具中的bug?,android,xml,drawable,Android,Xml,Drawable,看下图,左边的按钮是安卓2.1,右边的是安卓2.2: 正如您所看到的,左图上的角没有正确应用,但它们在2.2中看起来非常完美。我使用的xml如下所示: <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:right="0dip" android:left="0dip" android:bottom="0dip" android:top="0dip"

看下图,左边的按钮是安卓2.1,右边的是安卓2.2:

正如您所看到的,左图上的角没有正确应用,但它们在2.2中看起来非常完美。我使用的xml如下所示:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:right="0dip" android:left="0dip" android:bottom="0dip"
    android:top="0dip">
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <corners android:bottomRightRadius="3dip"
            android:bottomLeftRadius="3dip" android:topLeftRadius="3dip"
            android:topRightRadius="3dip" />
        <stroke android:width="1dip" android:color="#70532B" />
        <padding android:left="1dip" android:top="1dip"
            android:right="1dip" android:bottom="1dip" />
    </shape>
</item>
<item android:right="0dip" android:left="0dip" android:bottom="0dip"
    android:top="9dip">
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <gradient android:startColor="#ECAF08" android:endColor="#F6E34B"
            android:angle="270" />
        <corners android:bottomRightRadius="3dip"
            android:bottomLeftRadius="3dip" android:topLeftRadius="0dip"
            android:topRightRadius="0dip" />

    </shape>



</item>
<item android:right="0dip" android:left="0dip" android:bottom="11dip"
    android:top="0dip">
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <gradient android:startColor="#FCEF94" android:endColor="#FFBA00"
            android:angle="270" />
        <corners android:bottomRightRadius="0dip"
            android:bottomLeftRadius="0dip" android:topLeftRadius="3dip"
            android:topRightRadius="3dip" />
    </shape>
</item>


我是做错了什么,还是这是安卓2.1中的一个bug?

制作渐变按钮的聪明方法


我想知道这是否与Android2.1及以下版本中的
xml存在缺陷有关。bottomLeftRadius实际上对应于bottomRightRadius,反之亦然。他们可能已经在2.2中修复了它,因此它在2.2中看起来是正确的,但是在2.1和更低版本中,您以意想不到的方式重叠了。如果是这种情况,您可以使用针对版本的文件夹为每个版本使用不同的drawable(又名,
/drawable-v7/
/drawable-v8/
)。

因此,问题是,似乎不能有一个上角和下角不成角的矩形。我以前见过这个问题。上一次我碰到它时,我找到了一个解决办法,基本上是在有角矩形的顶部覆盖一个矩形,从而使底部露出有角,顶部保持平坦。它很粗糙,但很有效。另一件有点烦人的事情是,你不能使用相对维度?i、 在我上面的例子中,你可能注意到我分别有11和9次下陷。使用51%和49%之类的东西当然很好。。。