移除谷歌Android地图API V2了一圈,但不清除地图 [英] Remove a circle from Android Google Maps API v2 without clearing map

查看:138
本文介绍了移除谷歌Android地图API V2了一圈,但不清除地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我画一个圆圈在我的地图是这样的:

I am drawing a circle on my map like this:

CircleOptions circle=new CircleOptions();
circle.center(centre);
circle.strokeColor(0xFFFFA420);
circle.strokeWidth(2f);
circle.fillColor(0x11FFA420);
circle.radius(radius);
myMap.addCircle(circle);

要删除这个圈子里,我打电话 myMap.clear(),其中删除添加到地图中的所有项目。
现在的问题是如何消除这个圈子没有在地图上删除所有其他项目?

To remove this circle, I am calling myMap.clear(), which removes all items added to the map. The question is how to remove this circle without removing all others items on the map?

推荐答案

尝试调用<一个href=\"https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Circle#remove%28%29\"><$c$c>remove()圆形对象,你得到回addCircle()
例如:

Try calling remove() on the Circle object that you get back from addCircle(). For Example

Circle mapCircle;
mapCircle = mapView.addCircle(circleOption);

当你想删除

现在
调用此方法

Now when you want to remove Call this method

if(mapCircle!=null){
  mapCircle.remove();
}

这篇关于移除谷歌Android地图API V2了一圈,但不清除地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆