开发者

How to get all childs view in group with ExpandableListView

开发者 https://www.devze.com 2023-03-25 02:54 出处:网络
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?

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;
}


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号