如何让所有孩子的查看组ExpandableListView [英] How to get all childs view in group with ExpandableListView

查看:149
本文介绍了如何让所有孩子的查看组ExpandableListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的扩展列表视图checkboxex。我需要检查所有子盒当我检查组复选框。如何获得所有子视图组?

I am using expandable list view with checkboxex. I need to check all child boxes when i check group checkbox. How to get all child views in group?

public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {

if (convertView == null) {
    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    groupRow = vi.inflate(R.layout.season, parent, false);

} else {
    groupRow = convertView;
}
TextView seasonTitle = (TextView) groupRow.findViewById(R.id.season_title);
seasonTitle.setText(getGroup(groupPosition).toString());
CheckBox checkBox = (CheckBox) groupRow.findViewById(R.id.season_check_box);


checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        ???
    }
});

return groupRow;

}

推荐答案

尝试使用ArrayList中包含布尔对象,这样你可以将它们全部设置为选中,或者全部为未登记的groupcheckbox。

Try using ArrayList containing Boolean objects, this way you can set them all to "checked", or all to "unchecked" with the groupcheckbox.

这篇关于如何让所有孩子的查看组ExpandableListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆