开发者

ListView onitemclick is not working

开发者 https://www.devze.com 2023-04-07 06:51 出处:网络
I have a ListView containing a checkbox, an imageview, two textviews and a button. T开发者_如何学Gohe problem is after adding the checkbox and the button the onitemclick event of the ListView is not r

I have a ListView containing a checkbox, an imageview, two textviews and a button. T开发者_如何学Gohe problem is after adding the checkbox and the button the onitemclick event of the ListView is not responding. Will anybody suggest a work around for the problem?


You can set both android:focusable and android:focusableInTouchMode attributes of checkbox to false and onItemClick of the list will be called. But you'll have to call CheckBox#toggle() yourself in onItemClick.


Add an onlick listner to the view. or the checkbox and handle it manually.


When you use checkbox in your listview then it consumes your click action and your check action will be performed.

You can put click listener over textview, imageview or button. you also need to handle checkbox.

0

精彩评论

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

关注公众号