将标记从Android上的Google Maps Android API实用程序库群集中排除? [英] Exclude marker from clustering Google Maps Android API Utility Library on Android?
问题描述
我正在使用Google Maps Android Utility Library在ClusterManager中添加对象/标记,但是我想排除/添加一些不在Cluster中的标记.我可以使用googleMap.addMarker()在地图上添加标记而不进行聚类,但问题是我必须处理已向ClusterManager注册的OnInfoWindowClickListener,因此我可以注册对排除的标记的点击.
I am using Google Maps Android Utility Library adding objects/markers in ClusterManager , but I would like to exclude/add some markers that are not in Cluster. I was able to add markers on map using googleMap.addMarker() without clustering but the problem is that i have to handle OnInfoWindowClickListener wich is registered with ClusterManager so i can register the click on excluded Markers.
是否可以将实用程序库中的ClusterManager与不在群集中的某些标记合并并注册OnInfoWindowClickListener?
Is there a posibility to combine ClusterManager from Utility Library with some markers that are not in cluster and register OnInfoWindowClickListener ?
推荐答案
我自己还没有尝试过,但这应该可行:
I haven't tried it myself, but this should work:
- 创建扩展
ClusterManager
的类
- 覆盖
onInfoWindowClick
并致电super.onInfoWindowClick
- 检查作为参数发送给您的
Marker
是否是通过GoogleMap.addMarker
添加的参数
- 做你的事
- create class extending
ClusterManager
- override
onInfoWindowClick
and callsuper.onInfoWindowClick
- check if
Marker
sent to you as a parameter is the one you added viaGoogleMap.addMarker
- do your stuff
如果您对这样的代码不满意,请 Android地图扩展具有通过调用
If you are not happy with a code like that, Android Maps Extensions has such a functionality built in with a call to
marker.setClusterGroup(ClusterGroup.NOT_CLUSTERED);
这篇关于将标记从Android上的Google Maps Android API实用程序库群集中排除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!