【问题标题】:ExpandableListView Adapter List<object>ExpandableListView 适配器列表<object>
【发布时间】:2016-11-23 19:35:02
【问题描述】:

我收到发送到我的ExpandableListViewAdapter 列表。里面有String title 和另一个列表。

我正在关注本指南http://www.androhub.com/android-expandablelistview/,但不知道如何接收(在适配器构造函数上)我的列表以显示 ExpandableListView

我试过了:

private List<MyClass> dat;
private Context _context;
private List<String> header, a;
private HashMap<String, List<String>> child;

 public TestAdapter(Context _context, List<MyClass> dat) {
    this._context = _context;
    this.dat = dat;
    HashMap<String, List<String>> hashMap = new HashMap<String, List<String>>();

    for(int i = 0; i<dat.size(); i++){
        for(int j = 0; j < dat.get(i).getDestinations().size(); j++){
            a.add(dat.get(i).getDestinations().get(j).getTitle());
        }
        header.add(dat.get(i).getTitle());
    }
    for(int i = 0; i<header.size(); i++){
        hashMap.put(header.get(i), a);
    }
}

但不起作用。

【问题讨论】:

标签: android adapter expandablelistview


【解决方案1】:

用这个link..解释好多了..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-04
    • 2018-10-16
    相关资源
    最近更新 更多