ListView的setOnItemClickListener事件和ListView中Item中包含的子控件(比如button)的click事件共存的解决办法:
在ListView的item的xml配置文件的根节点添加属性
android:descendantFocusability="blocksDescendants",
在ListView的item的xml配置文件的根节点添加属性
android:descendantFocusability="blocksDescendants",
并且,在要添加事件的子控件(如button)的属性里添加android:focusable="false"
原文
http://blog.sina.com.cn/s/blog_618199e601010ndr.html
本文介绍了解决ListView的setOnItemClickListener事件与Item内子控件(如button)的click事件冲突的方法。通过在XML配置文件中设置特定属性,可以确保两种事件能够同时正常工作。
5139

被折叠的 条评论
为什么被折叠?



