【问题标题】:How to add an ExpandableListadApter in a MergeAdapter from cwac如何从 cwac 在 MergeAdapter 中添加 ExpandableListadApter
【发布时间】:2013-05-03 15:12:41
【问题描述】:

我正在使用来自以下位置的 MergeAdapter: https://github.com/commonsguy/cwac-merge

我想将 ExpandableListadApter 添加到 MergeAdapter,但它目前采用“ListAdapter”类型。有谁知道这样做的方法吗?

【问题讨论】:

标签: android expandablelistview expandablelistadapter


【解决方案1】:

AFAIK,MergeAdapter 仅支持ListAdapter 接口。除了分叉 repo 和添加对ExpandableListAdapter 的支持之外,我认为只有另一种方法可以“破解”快速解决方案。

Android 使用ExpandableListConnectorExpandableListAdapter 映射到BaseAdapter。您可以直接将该类复制到您的项目中,并使用您的ExpandableListAdapter 对其进行实例化。这将为您提供一个可与MergeAdapter 一起使用的ListAdapter 兼容适配器。

请注意,我从未尝试过这个......但理论上它应该可以工作。

ExpandableListConnector source code

【讨论】:

    猜你喜欢
    • 2015-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多