参考博文: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
Problem: OnItemClickListener 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
Problem: OnItemClickListener just doesn’t repond.
Reason: the TextView overrides focus of list item.
Solution: just remove attribute “android:autoLink” on TextView.
时间: 2024-10-05 05:07:15