我有一个使用两个游标的expandableList:1个用于组,另一个用于与该组相关的子级。 用户可以在此可扩展列表上使用过滤器(alphaindexer)。 我想在没有孩子的时候完全删除groupview(不仅是icon :)。这就像我删除空组的行。
我尝试将可见性设置为bindgroupview方法。我尝试设置组视图的布局高度....结果是相同的,空间仍然保留并显示。
是否可以,我该如何使用此功能?
以下一些代码:
// mMapSeqArticle is TreeMap<Object, ArrayList<Object>)
mSequenceAdapter = new SequenceCommandeAdapter(getActivity(), mMapSeqArticle);
public class SequenceCommandeAdapter extends BaseExpandableListAdapter {
Object[] mGroupSeq = null;
Map<Sequence, ArrayList<TicketArticle>> mContent;
public SequenceCommandeAdapter(Context c,
Map<Sequence, ArrayList<TicketArticle>> map) {
mContent = map;
mGroupSeq = mContent.keySet().toArray();
}
@Override
public Object getChild(int groupPosition, int childPosition) {
Sequence s = (Sequence) mGroupSeq[groupPosition];
return ((ArrayList<TicketArticle>) (mContent.get(s)))
.get(childPosition);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
Sequence s = (Sequence) mGroupSeq[groupPosition];
return ((ArrayList<TicketArticle>) (mContent.get(s)))
.get(childPosition).mId;
}
@Override
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
// retrouve la valeur de la sequence
TicketArticle ta = (TicketArticle) getChild(groupPosition,
childPosition);
if (convertView == null) {
convertView = LayoutInflater.from(getActivity()).inflate(
R.layout.adapter_row_article_details_table, null);
}
convertView.setTag(groupPosition + ":" + childPosition);
return convertView;
}
@Override
public int getChildrenCount(int groupPosition) {
Sequence s = (Sequence) mGroupSeq[groupPosition];
return ((ArrayList<TicketArticle>) (mContent.get(s))).size();
}
@Override
public Object getGroup(int groupPosition) {
return (Sequence) mGroupSeq[groupPosition];// mContent.get(groupPosition);
}
@Override
public int getGroupCount() {
return mContent.size();
}
@Override
public long getGroupId(int groupPosition) {
return ((Sequence) mGroupSeq[groupPosition]).key;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getActivity()).inflate(
R.layout.adapter_header_sequence_details_table, null);
}
convertView.setTag(null);
return convertView;
}
@Override
public boolean hasStableIds() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return true;
}
}
答案 0 :(得分:0)
我没有在你的代码中看到bindGroupView方法,但从你所描述的内容来看,这听起来就像你在正确的轨道上。我必须设置GONE的所有子视图(包括布局)的可见性,以便组行完全从可扩展列表视图中消失。否则,空行仍然存在。
如果你发布了R.layout.adapter_header_sequence_details_table的内容,我会更好地了解你需要做的其他事情。