Android Listview with Checkbox and All Clickable

Android listview elements with clickable animated checkboxes

Alright, I got it. I just was starting animation inside my custom checkbox class every time I draw it.

List item with CheckBox not clickable

As described here and here, this is either a known problem or works as designed. If you have any clickable or focusable items in a list item, the list item itself cannot be clickable. Romain Guy says "This is working as intended to support trackball/dpad navigation."

listview with checkbox single clickable

This should take care of your requirement. A very good tutorial on how you can achieve this.

http://tokudu.com/2010/android-checkable-linear-layout/

So the basic funda is that,

  1. Extend a Layout (Linear/Relative) and implement the checkable interface.
  2. After inflating the layout, find out which child was selected and check the corresponding checkbox. Uncheck any other previously checked item.
  3. Make sure that your ListView's XML has the following marked [android:choiceMode="singleChoice"]

Why I cant click on a ListView Item when I added a checkbox next to it in Android

Add checkbox.setFocusable(false) in your getView() method. This will allow your list item to get click.



Related Topics



Leave a reply



Submit