使用CursorTreeAdapter的ExpandableListView的子标头

时间:2010-09-29 18:18:17

标签: android header expandablelistview

如何为每个展开的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;
  }
}

任何帮助/指针都会非常有用。

1 个答案:

答案 0 :(得分:0)

您可以在newChildView函数中创建为新视图加载的布局XML。