InfoWindow中的Android Google Maps代码片段自动更新 [英] Android Google Maps snippet auto update in InfoWindow
问题描述
我在我的应用程序中使用Google地图时使用了少量标记。每隔几秒我就从API标记位置加载。每个标记都设置了标题和片段。在片段中,我想显示加载数据的时间。
问题在于,当用户点击其中一个标记并
InfoWindow
中的内容不会更改 - 用户必须单击地图以隐藏 InfoWindow
,然后单击然后内容是正确的。是否有可能在title或snippet之后刷新 InfoWindow
内容我发现使用Android Maps Extensions的解决方案
更新后调用标记数据:
标记m = map.getMarkerShowingInfoWindow();
if(m!= null&&!m.isCluster()){
m.showInfoWindow();
}
I'm using Google Maps in my app with few markers. Every few seconds I'm loading from API markers positions. Each marker has set title and snippet. In snippet I would like to display time when data was loaded.
Problem is that when user clicked on one of the markers and InfoWindow
with title and snippet is visible then after that I change the snippet & the content but the content on visible InfoWindow
is not changed - user has to click on the map to hide InfoWindow
and click again on marker - then the content is correct.
Is it possible to refresh InfoWindow
content after title or snippet has changed?
I found solution using Android Maps Extensions https://github.com/mg6maciej/android-maps-extensions.
Call this after update markers data:
Marker m = map.getMarkerShowingInfoWindow();
if (m != null && !m.isCluster()) {
m.showInfoWindow();
}
这篇关于InfoWindow中的Android Google Maps代码片段自动更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!