1. 子控件需要在添加分割线则在其父容易中定义divider
android:showDividers="middle"
2. showDividers 可选的参数有 :
beginning | 只在开始的的位置 |
end | 只在结束的位置 |
middle | 每一个子控件中间 |
none | 无分割线 |
3. 设置divider样式,无法单纯设置divider颜色来显示他,还需要(图片、drawable)设置divider的样式:
shape_main_hbf.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00ffff" />
<size android:height="1dp" />
</shape>
4. 父容器设置
android:showDividers="middle"
android:divider="@drawable/shape_main_hbf"
5