2014-01-08 106 views
0

你好嗎?如何在ExpandableListview中添加子項

我需要你的幫助,我想用WS的信息做一個ExpandableListview,我得到第一個信息組,當我點擊一個組的項目時,我必須得到其他Web服務的信息並顯示,我的問題是我如何刷新子列表並擴展信息dynamicallt ?.如果我只在GroupHeader之前創建並展示ExpandableList。

感謝您的關注,並抱歉我的英文不好。

回答

0

您將需要更新您的ListAdapter與新的組/兒童信息。假設您已生成一些ExpandableListAdapter,您可以創建一個新的,然後在新數據可用時更新適配器的ListView:

private ExpandableListView mList; 
private SimpleExpandableListAdapter mAdapter; 

    // assume you've already set up the data in the adapter as per the description 

    mAdapter = new SimpleExpandableListAdapter(
      //... all of the fields to initialize, passing in the new children info ... 
      ); 
    mList.setAdapter(mAdapter); 
相關問題