您的位置:首页 > 其它

ListView中的onItemClick无法被响应

2016-07-06 15:40 330 查看
按照网上绝大多数人的说法,基本都是如下解决方案:
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,导致他们都不能被点击了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息