目录
一、给控件或布局加整体边框
在drawable文件夹中新建drawable资源文件夹 background_frame.xml:
background_frame.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FFFFFF" />
<stroke
android:width="1dp"
android:color="#000000" />
<padding
android:bottom="0.1dp"
android:left="0.5dp"
android:right="0.5dp"
android:top="0dp" />
</shape>
在布局文件中应用:
效果如下:
二、在控件或布局中加单条边框
在drawable文件夹中新建drawable资源文件夹 background_line.xml:
background_line.xml:
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 连框颜色值 -->
<item>
<shape>
<solid android:color="#000000" />
</shape>
</item>
<!-- 主体背景颜色值 -->
<item android:bottom="1dp"> <!--设置只有底部有边框-->
<shape>
<solid android:color="#ffffff" />
</shape>
</item>
</layer-list>
在布局文件中应用:
效果如下:
简单粗暴!
感谢ლ(°◕‵ƹ′◕ლ)!!!