Android ListView元素间隙线自定义渐变效果
首先创建一个简单的ListView,并设置对应的属性<ListView
android:
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:divider="@drawable/jblineshape"
android:dividerHeight="1sp">
</ListView>
1
注意其中两句:对应的就是设置ListView中的Item之间的间隙线的,使用的一个XML文件:jblineshape.xml(实现的是渐变线的效果)
android:divider="@drawable/jblineshape"
android:dividerHeight="1sp"
查看源码打印?
配置文件:jblineshape.xml,为渐变效果的,透明->白色->透明(可根据自己需要进行设置
配置文件:jblineshape.xml,为渐变效果的,透明->白色->透明(可根据自己需要进行设置)
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:andro >
<gradient
android:startColor="#00000000"
android:centerColor="#FFFFFF"
android:endColor="#00000000"
/>
<corners
android:radius="4dp"
/>
</shape>
效果图:
最后更新:2017-04-02 16:47:37