前言
安卓中无法通过设置属性给控件设置边框,但是可以在Drawable下新建xml文件,然后给控件设置背景来实现:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- This is the main color -->
<item>
<shape>
<!-- 边框颜色 -->
<solid android:color="#808080"/>
</shape>
</item>
<!-- 给View的上 左 右设置8dp的边框 -->
<item android:bottom="10dp">
<shape>
<!-- View填充颜色 -->
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>