Android ListView with Checkbox: automatically unchecks

后端 未结 2 1587
再見小時候
再見小時候 2021-01-02 22:01

I\'ve got a ListView with a custom BaseAdapter. The list items contain CheckBoxes that need to represent a property from a database.

I use CheckBox.setOnCheckedChang

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-02 22:30

    Apparently the problem was that, by getting the checkbox using convertView.findViewById(), the onCheckedChangeListeners were still intact if the view was recycled. Calling checkbox.setOnCheckedChangeListener(null) did the trick.

提交回复
热议问题