ListView中的onItemClick无法被响应

来源:互联网 发布:美国数据网站 编辑:程序博客网 时间:2024/05/01 23:34

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

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.

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

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

0 0
原创粉丝点击