2014-05-25
一般只需要在xml文件里设置showDividers 和 divider就可以,以下是调用系统的分割线
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:showDividers="middle" android:divider="?android:attr/listDivider" />
要是在代码里设置
setShowDividers setShowDivider
注意,如果直接给divider颜色值是不会生效的,需要用shape定义
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <size android:width="200" android:height="1dp" /> <solid android:color="#fff" /> </shape>