您的位置:首页 > 移动开发 > Android开发

<转载>Android ListView 美化 去阴影 底色 选中色 间隙线

2012-12-07 10:27 645 查看
1.去滑动到顶点和底边时的黑色阴影

[html] view
plaincopy

android:fadingEdge="none"

2.去拖动时默认黑色底色

[html] view
plaincopy

android:cacheColorHint="#00000000"

3.去选中时的黄色底色

[html] view
plaincopy

android:listSelector="#00000000"

间隙线	首先创建一个简单的ListView,并设置对应的属性

<ListView
android:id="@+id/artistsNameView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:divider="@drawable/jblineshape"
android:dividerHeight="1sp">
</ListView>
注意其中两句:对应的就是设置ListView中的Item之间的间隙线的,使用的一个XML文件:jblineshape.xml(实现的是渐变线的效果)
android:divider="@drawable/jblineshape"
android:dividerHeight="1sp"
view sourceprint?
配置文件:jblineshape.xml,为渐变效果的,透明->白色->透明(可根据自己需要进行设置)

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:startColor="#00000000"
android:centerColor="#FFFFFF"
android:endColor="#00000000"
/>
<corners
android:radius="4dp"
/>
</shape>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: