Expandable listview with selectall checkbox : group itemclick and scrolling bug

后端 未结 1 1508
情书的邮戳
情书的邮戳 2021-01-19 06:20

I have an ExpandableListView with a checkbox next to group name and when expanded, child items with checkbox as well.

Let\'s suppose I have 4 groups with 50 childs.

相关标签:
1条回答
  • 2021-01-19 06:47

    I've found the solution. Instead of using OnCheckedChangeListener on the groupcheckbox, I used OnClickListener and it solved everything like this :

    gholder.groupcheckbox.setChecked(array.get(groupPosition).isCheck());
    gholder.groupcheckbox.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
    
                    for(int i = 0;i<array.get(groupPosition).getContacts().size();i++){
                        array.get(groupPosition).getContacts().get(i).setCheck(gholder.groupcheckbox.isChecked());
                    }
    
                    array.get(groupPosition).setCheck(gholder.groupcheck.isChecked());
    
                    notifyDataSetChanged();
                }
            });
    
    0 讨论(0)
提交回复
热议问题