2010-09-29 47 views
0

如何在不影響底圖數據和ChildView上的onClick/onLongClick事件的情況下爲每個展開的ChildView創建標題。下面是我ExpandableListView適配器的框架實現:使用CursorTreeAdapter的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

我在做類似的事情http://stackoverflow.com/questions/10611927/simplecursortreeadapter-and-cursorloader – toobsco42 2012-05-16 07:31:17

回答

0

您可以在newChildView函數中爲新視圖創建佈局XML。

相關問題