【发布时间】:2015-12-03 09:16:30
【问题描述】:
编辑:这个问题是关于 Android 上的谷歌地图。
我正在尝试为具有聚类的标记创建自定义信息窗口。我按照这里给出的说明https://stackoverflow.com/a/21964693/1641882
我做了这些:
将集群管理器设置为信息窗口适配器
// Setting custom cluster marker manager for info window adapter
map.setInfoWindowAdapter(mClusterManager.getMarkerManager());
mClusterManager.getMarkerCollection().setOnInfoWindowAdapter(new MyLocationInfoWindowAdapter());
为clusterItem信息窗口设置点击监听
mClusterManager.setOnClusterItemInfoWindowClickListener(new ClusterManager.OnClusterItemInfoWindowClickListener<LocationMarker>() {
@Override
public void onClusterItemInfoWindowClick(LocationMarker locationMarker) {
Toast.makeText(context, "info window Click", Toast.LENGTH_SHORT).show();
}
});
这是我的信息窗口适配器
private class MyLocationInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
TextView helloTextView = new TextView(getContext());
helloTextView.setText("Hello Info contents");
helloTextView.setClickable(false);
return helloTextView;
}
}
【问题讨论】:
-
这是安卓版的吗?
-
是的,它适用于 Android。很抱歉,不清楚我是否会编辑问题。
标签: android google-maps google-maps-markers