现在的位置: 首页 > 综合 > 正文

Android drawable shape绘制边框

2018年04月13日 ⁄ 综合 ⁄ 共 452字 ⁄ 字号 评论关闭

自己用xml实现shape,需要绘制边框,最后的结果如下!

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item android:right="0dp">
        <shape android:shape="rectangle" >
            <solid android:color="@color/greennormal" />
        </shape>
    </item>
    <item android:right="1dp" android:top="1dp" android:left="1dp" android:bottom="1dp">
        <shape android:shape="rectangle" >
            <solid android:color="@color/white" />
        </shape>
    </item>

</layer-list>

主要思想就是下边线铺一层需要边框颜色的背景图,然后上面加上需要的背景  用right left top bottom来控制边框的大小!

抱歉!评论已关闭.