我正在按照谷歌开发者网站的方式添加折线选项。
我想要删除它,但是没有
PolylineOptions rectOptions = new PolylineOptions()
.add(new LatLng(37.35, -122.0))
.add(new LatLng(37.45, -122.0)) // North of the previous point, but at the same longitude
.add(new LatLng(37.45, -122.2)) // Same latitude, and 30km to the west
.add(new LatLng(37.35, -122.2)) // Same longitude, and 16km to the south
.add(new LatLng(37.35, -122.0)); // Closes the polyline.
// Get back the mutable Polyline
Polyline polyline = myMap.addPolyline(rectOptions);
我想要删除它,但是没有
rectOptions.remove()
。如Google Maps Android API v2, how to remove Polylines from the map?所述,我从SDK更新了google play服务,但仍然没有它。在只更新SDK管理器之后,我应该做些什么吗?我真的需要将其移除而不是使其不可见以节省内存,因为我将显示很多点的路径多次。
map.clear();
。但是要小心地处理地图上的其他事情! :) - MHSaffari