如何更改标记在 Android Map v2 上的位置 [英] How to change the position of a Marker on a Android Map v2

查看:29
本文介绍了如何更改标记在 Android Map v2 上的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要执行以下操作:我在地图上有一个标记,我需要改变它的位置.所以我尝试了以下方法:

I need to do the following: I have a Marker on the map and I need to change the position of it. So I tried the following:

MarkerOptions a = new MarkerOptions()
            .position(new LatLng(50,6)));
        map.addMarker(a);
        a.position(new LatLng(50,5));

其中 map 是 GoogleMap.我想我必须刷新地图或其他相同的东西?

where map is a GoogleMap. I think I have to refresh the map or somthing equal?

推荐答案

找到了解决方案,需要这样做:

Found the solution, Need to do it like this:

MarkerOptions a = new MarkerOptions()
    .position(new LatLng(50,6)));
Marker m = map.addMarker(a);
m.setPosition(new LatLng(50,5));

这篇关于如何更改标记在 Android Map v2 上的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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