我怎么页脚视图添加到在ExpandableListActivity孩子列表? [英] How do I add a footer View to a child List in a ExpandableListActivity?

查看:83
本文介绍了我怎么页脚视图添加到在ExpandableListActivity孩子列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图找出如何给孩子查看在添加到子列表 ExpandableListActivity ,但无济于事。

I've been attempting to work out how to add a child View to a child List in an ExpandableListActivity, but to no avail.

我可以得到 ExpandableListView 并调用 addFooterView()就可以了,但只是增加了新的查看到组列表。 (该数据来自光标)。

I can get the ExpandableListView and call addFooterView() on it, but that just adds the new View to the group list. (The data comes from a Cursor).

任何建议感激地接受。

干杯

詹姆斯

推荐答案

不幸的是没有 ExpandableListView.addChildFooterView()方法,甚至 ExpandableListView .addFooterView()为此事。您所呼叫的方法是继承 ListView.addFooterView(),它只是增加了视图作为整个列表的最后一个项目。它没有覆盖组/儿童行为。

Unfortunately there is no ExpandableListView.addChildFooterView() method, or even ExpandableListView.addFooterView() for that matter. The method you are calling is the inherited ListView.addFooterView(), which just adds the view as the last item in the entire list. It was not overridden for group/child behavior.

要做到这一点最简单的方法可能是刚刚建立的东西到你的 ExpandableListAdapter 实施,使 getChildrenCount()返回数据集的大小+ 1,然后返回页脚视图getChildView()为适当的位置。此外, getChildView()提供了一个布尔参数标志时,它是指检索任何特定的组最后一个孩子。

The simplest way to do this is probably just to build something into your ExpandableListAdapter implementation so that getChildrenCount() returns the data set size + 1, and then return the footer view in getChildView() for the appropriate position. Also, getChildView() provides a boolean parameter to flag when it is retrieving the last child in any specific group.

这篇关于我怎么页脚视图添加到在ExpandableListActivity孩子列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆