tags:

views:

11372

answers:

4
+2  A: 

I've had a similar issue occur and found that the CheckBox is rather finicky in a ListView. What happens is it imposes it's will on the entire ListItem, and sort of overrides the onListItemClick. You may want to implement a click handler for that, and set the text property for the CheckBox as well, instead of using the TextViews.

I'd say look into this View object as well, it may work better than the CheckBox

Checked Text View

Andrew Burgess
I've found that if you set the "focusable" setting to false for the focusable items in list, you can use your onListItemClick function again.
MattC
+23  A: 

The issue is that Android doesn't allow you to select list items that have elements on them that are focusable. I modified the checkbox on the list item to have an attribute like so:

android:focusable="false"

Now my list items that contain checkboxes (works for buttons too) are "selectable" in the traditional sense (they light up, you can click anywhere in the list item and the "onListItemClick" handler will fire, etc).

MattC
Hey Matt - to be fair you should mark your answer as accepted one :) It will cost you 2 points so to offset it I upmarked your answer
DroidIn.net
I don't see an option to undo the answer I selected. And I don't really want to take the points away from the guy. :D
MattC
just click on the green check again to undo. and pls do because SO is all about having the best/correct answer on top.
Josef
It's not letting me. I originally posted the question with a bounty so that may be why.
MattC
Thank you so much for this!
sniurkst
A: 

Oh yes! android:focusable="false" did it for me! THANKS A LOT!

Philipz
No problem, but for future reference you should put this as a comment on my answer, and not a question response to the question. :)
MattC
Oh yeah, absolutely. Sorry im kinda new here! :D
Philipz
A: 

Hi guys,

Did anyone tried the focusable="false" solution for ImageButton? It's very strange, since I tried and it works for Button. I know that ImageButton is not subclass of Button, but if I use the ImageButton(I need to have different images on different states) then the solution doesn't work anymore, and I cannot press the items in the list, but only the ImageButton.

Does anyone have any ideas?

Thanks in advance.

marius