ExpandableListView 会记住选中的 iteme 并对其他子布局执行相同的操作

ExpandableListView works remembers checked itme and do the same to other child layout

我用ExpandableListView。我有 checkBox(在 child_layout 中),当我选中其中一个并关闭此 parent_layout 然后打开其他 parent_layout 时,还会(自动)选中复选框。

I opened Sports and then checked Football (child) and then closed

And when I opened the second one (Sciences) the checkBox was automatically checked

我该如何管理它?

您可以更换适配器。 例如,你可以保存一个boolean const来保存每个item的check status.And在getView()中判断它。设置boolean为true时的checkkbox状态检查。