本文介绍了排除群集标记 - 谷歌地图扩展(Android应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是谷歌地图的扩展版本1.3.1,我试图从被聚集排除标记。我有一个在我的应用程序的onCreate方法设置一个标志,它重新presents我的位置。我想这始终是可见的,不能以群集像我标记的其余部分。这可能吗?我尝试添加标记之前,我设置群集设置之前我叫setClustering的对象的GoogleMaps,但它似乎并没有工作。

I'm using version 1.3.1 of the Google Maps Extension and am trying to exclude a marker from being clustered. I have one marker that is set in the onCreate method of my app and it represents My Location. I want this to always be visible and not be clustered like the rest of my markers. Is this possible? I tried adding the marker before I set the clustering settings and before I called setClustering on the GoogleMaps object, but it doesn't seem to work.

推荐答案

如果您使用的是只有一个标记这不应该与其他所有被群集,你可以看到一个解决办法在评论#2浏览:

If you are using just one Marker which should not be clustered with all other, you can see a workaround in comment #2 here:

基本上使用 SupportMapFragment.getMap()。addMarker(...)而不是 SupportMapFragment.getExtendedMap()

问题是你会得到空的的GoogleMap 回调,如 onMarkerClick ,但只是一个标记你可以找到它的Marker(标记)。聚类引擎将不会意识到标记的补充的方式。
您也将有类名称冲突,所以你的情况下,使用完整的类名像 com.google.android.gms.maps.model.Marker 原始库你保持这个参考标记

The problem is you will get null in GoogleMap callbacks like onMarkerClick, but for just one Marker you can find out it's "the Marker". Clustering engine will not be aware of Marker added that way.You will also have class name collision, so you have to use full class name for original library like com.google.android.gms.maps.model.Marker in case you keep a reference to this Marker.

希望它能帮助,直到这一改进实现的。

Hope it helps until this improvement is implemented.

编辑:

这是可以作为的通过简单的通话1.5版本:

This is available as of version 1.5 via simple call:

theMarker.setClusterGroup(777);

默认的组是 0 只有标记 s的同一组聚集在一起,因此,如果你改变有一个标记的小组,你会得到预期的效果。

The default group is 0 and only Markers with the same group are clustered together, so if you change one Marker's group, you'll get the desired effect.

这篇关于排除群集标记 - 谷歌地图扩展(Android应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 23:51