我正在使用checkboxex的可扩展列表视图。当我选中组复选框时,我需要检查所有子框。如何在群组中获取所有子视图?
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;
}
答案 0 :(得分:2)
尝试使用包含Boolean对象的ArrayList,这样您就可以将它们全部设置为“checked”,或者将所有设置为“unchecked”with groupcheckbox。