如何在ExpandableListview中添加子项

时间:2014-01-08 20:58:48

标签: android expandablelistview

你好吗?

我需要你的帮助,我正在尝试使用WS的信息做一个ExpandableListview,我得到第一个信息组,当我在组的项目中点击时,我必须获取其他Web服务的信息并显示,我的问题是如何刷新子列表并扩展信息dynamicallt?如果我只使用GroupHeader创建并显示ExpandableList。

感谢您的关注,并抱歉我的英语不好。

1 个答案:

答案 0 :(得分: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);
相关问题