在Google Maps API,Android上显示多个信息Windows

问题描述:

我是一个初学者,尝试编写一个正在运行的应用程序,但遇到了问题.我每隔几秒钟运行一次循环,并想在google maps API上显示标记infowindow,如果时间已经超过了这些运行的总时间,我的问题是弹出一个infoWindow时,它必须关闭其他的,因为我只看到了bestMarker窗口,因为它在lastMarker之后. 这是我的代码-

I am a beginner trying to code a running app and have run into a problem. I am running a loop every few seconds and want to display a markers infowindow on google maps API if the time has passed the total time for those runs, my problem is when one infoWindow pops up, it must close the others because I only ever get the bestMarker window to show up since it comes after lastMarker. Here is my code -

if (getCount() >= lastDone) {
  lastMarker.setTitle("Done!");
  lastMarker.showInfoWindow();
 }
 if (getCount() >= bestDone) {
  bestMarker.showInfoWindow();
  bestMarker.showInfoWindow();
 }

如果有人有办法使两个窗口同时保持打开状态,将不胜感激!

If anyone has a solution to make both windows stay open at the same time it would be greatly appreciated!

好吧,

Well, Google Maps official doc says you can not display two/more infoWindows at a time.

信息窗口可让您在用户点击标记时向其显示信息. 一次只显示一个信息窗口.如果用户单击另一个标记,则当前信息窗口将被隐藏,并显示新信息窗口.

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

我的解决方案是-创建您的标记(自定义视图),如infoWindow设计.

My Solution will be - create your Markers (custom view) like infoWindow design.