java - 在 google maps api, android 上显示多个 infoWindows

标签 java android google-maps

我是一名初学者,尝试编写正在运行的应用程序,但遇到了问题。我每隔几秒运行一个循环,如果时间已经超过这些运行的总时间,我想在 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/

相关文章:

java - 运行 gradlew assembleRelease 时出现内存不足错误 - react-native

java - 如何解决 HttpURLConnection 上的 NullPointerException?

java - 设备上安装的应用程序未显示在应用程序菜单中

android - 模拟器不断在后台运行

javascript - 如何更改谷歌地图中控件div中的按钮样式?

javascript - JavaScript 中函数未定义

ios - 尝试在点击 Google map 标记时运行函数

java.io.FileNotFoundException 访问被拒绝

android - 如何验证 robotium 中的 View 或布局

java - 露天 : How to filter documents in workflow