【问题标题】:How to Add Child in ExpandableListview如何在 ExpandableListview 中添加子项
【发布时间】:2014-01-08 20:58:48
【问题描述】:

你好吗?

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

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

【问题讨论】:

    标签: android expandablelistview


    【解决方案1】:

    您需要使用新的组/孩子信息更新您的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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-30
      • 2022-11-07
      • 1970-01-01
      相关资源
      最近更新 更多