1. 不管你是自定义还是用相关的lib包,属性都是不变的,其实用自定义还是lib包 主要目的是为了实现下拉刷新,确实比较麻烦,下拉刷新时,在重写点击item的事件里,postion的数值比我们想象的要多加一个1,就是因为有个下拉头在里面占一个位置,在做数据相关处理时-1即可。
2. 点击listview的item时,系统默认的是当前点击的item背景变黄,去掉这个变化的xml代码为
android:cacheColorHint="#00000000"
android:listSelector="#00000000"
3.当要设置每个item的间距时 在listview的属性里 设置
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="36dp"
android:paddingRight="36dp"
设置整体布局的位置
android:divider="@null"
android:dividerHeight="10dp"
设置去除分割线和item的间距
4.设置每个item的圆角 则是在item的布局中加入设置圆角的xml文件,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient android:startColor="#e5e5e5"
android:endColor="#e5e5e5"
android:angle="270"/>
<corners android:topLeftRadius="8dip"
android:topRightRadius="8dip"
android:bottomLeftRadius="8dip"
android:bottomRightRadius="8dip"/>
</shape>
item的布局设置 android:background="@drawable/monitor_list_item_corner" 该为上面的文件名
5. android:fadingEdge="none" 去除滚动到上下边缘时的阴影
6.android:footerDividersEnabled="false"
android:headerDividersEnabled="false"
底部和顶部的分割线
7.android:scrollbars="none"
去除滑动时出现的滚动条
8.android:fastScrollEnabled="false"
禁止快速滑动功能,除非item很多时,可以支持下