Android上的形状可绘制

时间:2013-09-04 09:11:52

标签: android shape

我使用shape drawable绘制背景如下:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#888888"
        android:endColor="#888888"
        android:angle="270"/>
    <corners android:topLeftRadius="4dip"
        android:topRightRadius="4dip"/>
    <stroke
        android:width="2dip"
        android:color="#666666"
        android:dashWidth="10dip"
        android:dashGap="0dip" />
</shape> 

我想设置没有笔画的底边。
我怎么修改它?

1 个答案:

答案 0 :(得分:1)

试试这个

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

    <item>
        <shape>
            <padding
                android:bottom="3dip"
                android:left="3dip"
                android:right="3dip"
                android:top="3dip" />
            <corners
                android:topLeftRadius="6dip"
                android:topRightRadius="6dip" />

            <solid android:color="#666666" />
        </shape>
    </item>
    <item>
        <shape android:shape="rectangle" >
            <gradient
                android:angle="270"
                android:endColor="#888888"
                android:startColor="#888888" />
        </shape>
    </item>