ListView中的onItemClick无法被响应

按照网上绝大多数人的说法,基本都是如下解决方案:

http://www.cnblogs.com/ycxyyzw/p/3672366.html

但是我的listview就是死活不能被点击,最后一点点删代码,发现BaseAdapter的isEnabled代码引发的问题,我直接全部返回false了。

如下copy官方解释:

isEnabled

Added in  API level 1
boolean isEnabled (int position)

Returns true if the item at the specified position is not a separator. (A separator is a non-selectable, non-clickable item). The result is unspecified if position is invalid. An ArrayIndexOutOfBoundsException should be thrown in that case for fast failure.

Parameters
position int: Index of the item
Returns
boolean True if the item is not a separator
也就是说,这个函数是为了区分隔离符号和真正item的,如果是隔离符号返回false,如果是item返回true。这样隔离符号不能被点击,但是item可以被点击。

我直接所有都返回false,导致他们都不能被点击了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值