首页 > 其他 > 详细

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

时间:2015-10-17 16:09:15      阅读:165      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!