ExpandableListView 中的 Mapview

Mapview inside a ExpandableListView

我正在学习本教程 here 并且我正在尝试将 ImageView 更改为 MapView 但我不知道该怎么做,因为它解释了传递一个字符串数组来填充 ImageView .

我试过这样做:

如果您不知道如何使用 Google MapView,请关注 this tutorial

如果您想知道如何将数据传递给您的子适配器,而不是字符串数组,请构造一个 latitude-longitude 对数组,如下所示:

List<LatLng> locationList = new ArrayList<>();
locationList.add(new LatLng(55.854049, 13.661331));
locationList.add(new LatLng(56.854049, 14.661331));
.
.
.

在您的 Child.java class 中删除 int Image 并添加:

private LatLng location;

public int getLatLng() {
    return location;
}

public void setLatLng(LatLng location) {
    this.location = location;
}

并在您的 SetStandardGroups() 方法中进行必要的更改。而不是 ch.setImage(Images[j]) 添加以下内容:

ch.setLatLng(locationList.get(j));

之后,如果您知道如何使用列表适配器,您应该能够填充数据 ExpandListAdapter class.