android 用shape画矩形边框(可以只画任意一个边)

记录一下一些比较基础使用的东西,

在drawable新建xml文件,

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <solid android:color="#e5e5e5" />//边框颜色
        </shape>
    </item>
    <!--    想保留哪一边就设置哪一边边框,列如只有下边框:bottom="0.7dp",相应的有上top="",left="",right=""    -->
    <item android:bottom="0.7dp">
        <shape>
            <solid android:color="@color/color_white" />//整个框背景颜色
        </shape>
    </item>
</layer-list>

猜你喜欢

转载自blog.csdn.net/m13984458297/article/details/82782355
今日推荐