如何为每个展开的ChildView
创建标头,而不会影响ChildView
上的基础数据和onClick / onLongClick事件。下面是我的ExpandableListView
适配器的骨架实现:
私有类EAdapter扩展了CursorTreeAdapter {
public EAdapter(Cursor cursor, Context context) {
super(cursor, context);
}
@Override
protected void bindChildView(View view, Context context, Cursor cursor,
boolean isLastChild) {
}
@Override
protected void bindGroupView(View view, Context context, Cursor cursor,
boolean isExpanded) {
}
ChildHolder childHolder;
@Override
protected View newChildView(Context context, Cursor cursor,
boolean isLastChild, ViewGroup parent) {
view.setTag(childHolder);
registerForContextMenu(view);
return view;
}
GroupHolder groupHolder;
@Override
protected View newGroupView(Context context, final Cursor cursor,
boolean isExpanded, ViewGroup parent) {
view.setTag(groupHolder);
return view;
}
@Override
protected Cursor getChildrenCursor(Cursor groupCursor) {
return cursor;
}
}
任何帮助/指针都会非常有用。
答案 0 :(得分:0)
您可以在newChildView函数中创建为新视图加载的布局XML。