Pramod J George
Pramod J George

Reputation: 1723

ListView onitemclick is not working

I have a ListView containing a checkbox, an imageview, two textviews and a button. The 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?

Upvotes: 0

Views: 1562

Answers (3)

ernazm
ernazm

Reputation: 9258

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.

Upvotes: 5

Vineet Shukla
Vineet Shukla

Reputation: 24031

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.

Upvotes: 0

Hades
Hades

Reputation: 3936

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

Upvotes: 0

Related Questions