Android ListView with Checkbox and all clickable [duplicate]
Set the CheckBox
as focusable="false"
in your XML layout. Otherwise it will steal click events from the list view.
Of course, if you do this, you need to manually handle marking the CheckBox
as checked/unchecked if the list item is clicked instead of the CheckBox
, but you probably want that anyway.
Set the listview adapter to "simple_list_item_multiple_choice"
ArrayAdapter<String> adapter;List<String> values; // put values in this//Put in listviewadapter = new ArrayAdapter<UserProfile>(this,android.R.layout.simple_list_item_multiple_choice, values);setListAdapter(adapter);