我是一名初学者,尝试编写正在运行的应用程序,但遇到了问题。我每隔几秒运行一个循环,如果时间已经超过这些运行的总时间,我想在 google maps API
上显示一个标记 infowindow
,我的问题是当一个infoWindow
弹出,它必须关闭其他窗口,因为我只显示 bestMarker 窗口,因为它位于 lastMarker 之后。
这是我的代码-
if (getCount() >= lastDone) {
lastMarker.setTitle("Done!");
lastMarker.showInfoWindow();
}
if (getCount() >= bestDone) {
bestMarker.showInfoWindow();
bestMarker.showInfoWindow();
}
如果有人有办法让两个窗口同时保持打开状态,我们将不胜感激!
最佳答案
嗯,Google Maps official doc says您不能同时显示两个/更多信息窗口。
An info window allows you to display information to the user when they tap on a marker. Only one info window is displayed at a time. If a user clicks on another marker, the current info window will be hidden and the new info window will be displayed
我的解决方案是 - 创建您的标记(自定义 View ),如 infoWindow 设计。
关于java - 在 google maps api, android 上显示多个 infoWindows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37200201/