我有一个扩展BaseExpandableListAdapter的类:
public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
Filter filter = (Filter) getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.exp_list_child, null);
}
TextView tv = (TextView) convertView.findViewById(R.id.child_tv);
tv.setText(filter.toString());
tv = (TextView) convertView.findViewById(R.id.child_sub_tv);
tv.setText(filter.getType());
if(!filter.getType().endsWith("ExportPin"))
// I dont want to return antyhing
return convertView;
}
如您所见,我创建了所有内容,但如果过滤器的类型不以“ ”结尾(请参阅最后的 if 语句),TextView
我不想返回它。ExportPin
我无法返回null
,也不想返回空列表项。
在我的课上,我也有getChildrenCount()
,getGroupCount()
...
有任何想法吗?