码迷,mamicode.com
首页 > 其他好文 > 详细

ListView中各组件点击事件冲突,ListView不响应OnItemClickListener事件

时间:2015-10-17 16:11:33      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

参考博文:https://xjaphx.wordpress.com/2011/07/14/listview-doesnt-respond-to-onitemclicklistener/

#1,listview item中包含checkbox,需要改变checkbox的属性设置:

android:focusable="false"
android:focusableInTouchMode="false"

 

#2,包含ImageButton,在代码中设置:在布局文件中设置无效

ImageButton button = (ImageButton) convertView.findViewById(R.id.imageButton);
button.setFocusable(false);

 

#3,TextView超链接:我擦我受不了了,原博主太萌了,我要把ta的答案直接贴过来:

4. Scenario: list item contain TextView

ProblemOnItemClickListener just doesn’t repond.

Reason: I think you have set this attribute to TextView: android:inputType=”textMultiLine”

Solution: just remove that attribute, using android:minLines/android:maxLines instead.

5. Scenario: list item contain a TextView that is linked to website URL or whatever “mailto:” things

ProblemOnItemClickListener just doesn’t repond.

Reason: the TextView overrides focus of list item.

Solution: just remove attribute “android:autoLink” on TextView.

 

ListView中各组件点击事件冲突,ListView不响应OnItemClickListener事件

标签:

原文地址:http://www.cnblogs.com/mada0/p/4887533.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!