0
1:在案例中,如果任何一組有沒有項目,然後墜毀ExpandableList查看墜毀在零個項目情況一組
2:在情況下,如果只有一個組,然後它顯示了在只有一個項目打開該組。
public class AssignmentCompletedExpandableAdapter extends BaseExpandableListAdapter {
private List<String> _listDataHeader;
private HashMap<String, List<AssignmentScore>> _listDataChild;
public AssignmentCompletedExpandableAdapter(List<String> _listDataHeader,
HashMap<String, List<AssignmentScore>> _listDataChild){
this._listDataHeader = _listDataHeader;
this._listDataChild = _listDataChild;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
return _listDataChild.get(_listDataHeader.get(groupPosition)).get(childPosititon);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.size();
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
if(convertView == null){
convertView = ((LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).
inflate(R.layout.layout, null);
}
Data data = (Data) getChild(groupPosition, childPosition);
TaggedView view = TaggedView.getTaggedView(convertView);
view .name_textView.setText(data.getName());
view .score_textView.setText(data.getScore());
return convertView;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
if(convertView == null){
convertView = ((LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).
inflate(R.layout.layoutgroup, null);
}
TextView lblListHeader = (TextView)convertView.findViewById(R.id.groupname);
lblListHeader.setText((String)getGroup(groupPosition));
return convertView;
}
}
嘗試使用,如果條件或交換機爲例來檢查你的病情 –
匿名,什麼是其標記爲負的問題的呢? @Itsnotblank當我點擊具有零項的組時它爲getChild去哪裏,如果我把條件我需要重試一個視圖,應該有一個條件,它不會得到點擊,任何提示。 – strike