【问题标题】:How to clear location marker in Google Map如何清除谷歌地图中的位置标记
【发布时间】:2019-01-22 14:03:17
【问题描述】:

我正在使用GoogleMap 创建地图应用程序。在位置更改侦听器的帮助下将CustomMarker 从第一个位置移动到第二个位置时遇到问题。 CustomMarker 被重复,因为它在更新到新位置时也保持旧位置。请参考下图。

Duplication of single custom marker

【问题讨论】:

  • 您是否正在使用某种自定义可绘制对象并对其进行克隆?如果是,则不要使用克隆。
  • 你可以尝试this nice code移动标记而不移除它

标签: java android google-maps


【解决方案1】:

您为什么不直接使用clear() GoogleMap 来删除旧标记?

https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap.html#clear()

【讨论】:

    猜你喜欢
    • 2013-03-17
    • 1970-01-01
    • 2012-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-22
    • 2017-08-08
    • 1970-01-01
    相关资源
    最近更新 更多