난 당신이 배열 목록에서 검사 그룹의 상태를 추적해야 말을 믿고 링크 된 대답 .
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
CheckBox check__bookmark = (CheckBox)child_row.findViewById(R.id._checkBox);
if (mapp.group_bookmark_s_checked.containsKey((groupPosition))==true)
check__bookmark.setChecked(true);
else
check__bookmark.setChecked(false);
: 그런 다음 BaseExpandableListAdapter에 대한 getChildView 방법에 당신이 여기
내 구현입니다 .. 아이의 그룹이 존재하는지 확인하기 위해 검사를 할 것, 내가 대신 ArrayList에의 해시 맵을 사용하고 있습니다
}
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
CheckBox PlayGroupSelected = (CheckBox)group_row.findViewById(R.id.bookmark_group_checkBox);
if (mapp.group_bookmark_s_checked.containsKey((groupPosition))==true)
PlayGroupSelected.setChecked(true);
else
PlayGroupSelected.setChecked(false);
PlayGroupSelected.setOnCheckedChangeListener(new BookmarkGroupCheckedChangeListener(groupPosition, mapp, group_row));
지금 리스너에 당신은 제거하고 상태 개체에 추가하여 상태를 관리 할 수 있습니다. 체크 상태가 변경되면 자식이 새로 고쳐지지 않아 notifyDataSetChanged()를 사용했습니다. 그 문제를 해결하는 올바른 방법인지는 확실하지 않지만 그 트릭을 수행했습니다. http://prativas.wordpress.com/category/android/expandable-list-view-in-android/ 당신이 필요로하는 모든 것을 포함
class BookmarkGroupCheckedChangeListener implements OnCheckedChangeListener {
private int mPosition;
MyApplication mapp;
RelativeLayout mgroup_row;
BookmarkGroupCheckedChangeListener(int position, MyApplication app, RelativeLayout group_row) {
mapp = app;
mPosition = position;
mgroup_row = group_row;
}
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked == true) {
mapp.group_bookmark_s_checked.put((mPosition), new Boolean(true));
Log.v("DEBUG:", "Group Bookmark Checked On at " + mPosition);
notifyDataSetChanged();
}
else if (mapp.group_bookmark_s_checked.containsKey(mPosition)){
mapp.group_bookmark_s_checked.remove((mPosition));
Log.v("DEBUG:", "Checked Off at " + mPosition);
notifyDataSetChanged();
}
}
}
예. notifyDataSetChanged(); 중요하다. 탱크 – IndieBoy