开发者

Adding a CheckBox to ListView item prevents it from being able to receive ItemClick

开发者 https://www.devze.com 2022-12-20 15:39 出处:网络
In the Adapter for the ListView, I return a LinearLayout, in which I add a Checkbox, a ImageView and a TextView. This basically constructs a ListView, in which each item contains a Checkbox, a ImageVi

In the Adapter for the ListView, I return a LinearLayout, in which I add a Checkbox, a ImageView and a TextView. This basically constructs a ListView, in which each item contains a Checkbox, a ImageView and a TextView. However the strange thing is that if I don’t add the Checkbox, then ListView receives onItemClick event correctly, as long as I add the Checkbox, onItemClick of the ListView never gets fired again, as if the Checkbox eats all the OnClick event passed to ListView.

Any ideas how can I solve this? I want the user to be able to check/uncheck the Checkboxes and at the same time be able to click on these ListView items as w开发者_如何学Goell if they click on area for the ListView item other than the checkbox.


Set all items focusable="false"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号