android - 如何将页脚 View 添加到 ExpandableListActivity 中的子列表?

标签 android listview expandablelistview

我一直在尝试解决如何将子 View 添加到 ExpandableListActivity 中的子 List,但无济于事.

我可以获得 ExpandableListView 并对其调用 addFooterView(),但这只是将新的 View 添加到组列表中。 (数据来自 Cursor)。

非常感谢收到的任何建议。

干杯

詹姆斯

最佳答案

不幸的是,没有 ExpandableListView.addChildFooterView() 方法,甚至没有 ExpandableListView.addFooterView() 方法。您调用的方法是继承的 ListView.addFooterView(),它只是将 View 添加为整个列表中的最后一项。它没有被组/子行为覆盖。

执行此操作的最简单方法可能只是在您的 ExpandableListAdapter 实现中构建一些东西,以便 getChildrenCount() 返回数据集大小 + 1,然后返回getChildView() 中的页脚 View 的适当位置。此外,getChildView() 提供了一个 bool 参数,用于在检索任何特定组中的最后一个子项时进行标记。

关于android - 如何将页脚 View 添加到 ExpandableListActivity 中的子列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4542449/

相关文章:

c++ - Qml Listview 在重置模型时保留 View

java - 当父组已展开以显示其子组时,如何更改图标

java - 如何用Gson反序列化这个json?

android - 对于 Android,CheckBox 的 Selenium isSelected() 方法始终返回 false

android - Android Studio ArrayAdapter不起作用程序崩溃

android - 通过获取 textView 中的字符串来填充 ListView

android - 更新 ExpandableListView 中的子项

java - 可扩展 ListView android

android - 错误 : jest-haste-map: Haste module naming collision:

android - Android单元测试中如何通过ID访问资源?