ListView相关的知识

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很多时,可以支持下

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值