在Android中更新地图标记 [英] Updating a map marker in android
本文介绍了在Android中更新地图标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Google Maps Android API v2,我可以通过从hashMap获取Marker
然后调用以下命令来更新标记的位置:
Using Google Maps Android API v2, I can update my marker's position by getting the Marker
from a hashMap and then calling:
Marker marker = hashMap.get(someId);
marker.setTitle("Title");
marker.setSnippet("Snippet");
marker.setPosition(new LatLng(newLatitude, newLongitude));
但是,如果在调用标记时选择了标记,则仅当我单击标记并重新选择时,标题和摘录才会更新.无论如何,有没有告诉地图刷新标记气泡中的数据?
However, if the marker is selected when this is called, the title and snippet will only update if I click off the marker and reselect it. Is there anyway to tell the map to refresh the data in the marker bubble?
推荐答案
立即调用hideInfoWindow()
,然后调用showInfoWindow()
,
marker.hideInfoWindow();
marker.showInfoWindow();
这篇关于在Android中更新地图标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文