简体   繁体   中英

How to refresh markers position on google maps without clearing and blinking the map?

Is it possible to create Google Maps V2 markers which can be updated without blinking/clearing the whole map? Currently i have to clear the map and then add markers:

googleMap.clear();
googleMap.addMarker(new MarkerOptions().position(entry.getValue()).title(entry.getKey()));

But then the map blinks when cleared...

addMarker returns Marker object.

Marker marker = googleMap.addMarker(new MarkerOptions().position(entry.getValue()).title(entry.getKey()));

Use this object to change its position:

marker.setPosition(new LatLng(5, 5));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM