【问题标题】:Multiple layouts for one ExpandableListView一个 ExpandableListView 的多种布局
【发布时间】:2012-05-12 00:43:57
【问题描述】:

我有 ExpandableListView 并为我自己的适配器扩展了 BaseExpandableListAdapter。不过,我在使用分隔符时遇到了困难。我添加到我的对象列表中,这些对象转到 ExpandableListView “分隔符”到某些位置,我需要使用不同的行布局在 ExpandableListView 中显示它们。现在的问题是,BaseExpandableListAdapter 没有 BaseAdapter 所具备的 getViewTypeCount() 和 getItemViewType(int position) 方法。有什么办法吗?

【问题讨论】:

标签: android android-layout expandablelistview


【解决方案1】:

您可以通过为您想要的位置提供不同的Views 来实现这些“分隔符”。为此,请使用:

getChildType()getChildTypeCount()(针对不同的孩子Views
getGroupType()getGroupTypeCount()(针对不同的组Views

来自BaseExpandableListAdapter 类。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多