Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
596 views
in Technique[技术] by (71.8m points)

java - Show multiple infoWindows on google maps api, android

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...