开发过程中很多时候都是需要在控件的底部画一条线,但是用view实现感觉不是太好看,直接对控件设置一个只有底部描边的layer-list作为背景,也能实现这种效果:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape>
<solid android:color="@color/app_color_white" />
<stroke
android:width="0.5dp"
android:color="#ffe5e5e5" />
</shape>
</item>
</layer-list>
同理可以画出只有其他单边的layer-list