问题
Hi guys I am new to android...I want to display a dynamic list of CheckBox and on Clicking multiple of those CheckBoxes i want their data in a single string...But my problem is that i am unable to call onListItemClick method if I use checkBox in my List...
It is my understanding and experience however that putting a focusable view in the list item prevents the firing of onListItemClick() in the ListActivity when the list item is clicked. But can anyone Plz give me solution...
I have referred links like
How to fire onListItemClick in Listactivity with buttons in list?
Android ListActivity onListItemClick calls adapter getView
but unable to find a solution...
回答1:
To make it working you can set Checkboxes and other fields in the ListItem unclickable and unfocusable, by properties:
android:clickable="false"
android:focusable="false"
回答2:
Make sure you set the checkbox as not focusable in the adapter class, like this:
yourCheckbox.setFocusable(false);
And in the xml file as well:
android:focusable="false"
来源:https://stackoverflow.com/questions/11238639/onlistitemclick-method-not-called-when-i-use-checkox-in-list