【问题标题】:How to erase PolyLine in Google Map..?如何删除谷歌地图中的折线..?
【发布时间】:2016-07-07 16:46:47
【问题描述】:

首先,对不起我的英语。 我创建了用于检测步行和跟踪步骤的应用程序。跟踪步骤很好。但问题是应用程序重新检测步骤,在折线之前不会擦除。 我尝试 map.clear()、polyline.remove()... 等,但没有激活。

这是我绘制折线的来源

polyline = map.addPolyline(polylineOptions.add(new LatLng(location.getLatitude(), location.getLongitude())));
polylineOptions.width(5);
polylineOptions.color(Color.RED);
map.addPolyline(polylineOptions);

这会将 onLocationListener 放在 LocationListener 中。 location 是 onLocationListener 的参数。

如何删除以前的折线...? 我对我的英语感到抱歉。请帮帮我。

【问题讨论】:

  • 欢迎来到 SO,请在提问时更具体一点:您尝试过什么,您期望什么等。请参阅how to ask
  • 折线是什么样的可验证性?

标签: android google-maps dictionary polyline


【解决方案1】:

移除折线。

//Adds the line to map
Polyline line = map.addPolyline(polylineOptions);
//removes the same line from map
line.remove();

【讨论】:

  • 感谢您的帮助。但是line'remove是我已经使用方法了。没有操作。
【解决方案2】:

正如 Shapes 文档中特别提到的 Remove a Polyline,调用 setMap() 方法,将 null 作为参数从地图中删除一条折线。

删除折线sample中也显示了如何操作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-21
    • 2015-07-12
    • 1970-01-01
    • 1970-01-01
    • 2017-02-06
    • 1970-01-01
    • 1970-01-01
    • 2014-05-29
    相关资源
    最近更新 更多