如何改变在Android的地图V2标记的位置标记、位置、地图、Android

2023-09-06 13:33:50 作者:消失的无影无踪

我需要做到以下几点: 我在地图上的标记,我需要改变它的位置。因此,我试过如下:

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));

其中,地图是一个 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));