【问题标题】:How to get all childs view in group with ExpandableListView如何使用 ExpandableListView 获取组中的所有子视图
【发布时间】:2011-10-18 23:49:51
【问题描述】:

我正在使用带有 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;
}

【问题讨论】:

    标签: android checkbox expandablelistview


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2019-02-13
      • 1970-01-01
      • 1970-01-01
      • 2014-12-16
      • 1970-01-01
      • 2011-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多