1

The default behavior for an InfoWindow is to hide if the map the marker is in, or the marker itself are tapped.

Is there any way to make the InfoWindow permanent so you can't hide it?

I have disabled all gestures in the map, but the InfoWindow still disappears when you tap.

Alejandro Pérez
  • 2,557
  • 2
  • 17
  • 14

3 Answers3

3

visceralG's solution is what I would do in the first place, but there is also (untested) alternative:

  • keep a reference to marker showing info window (from getInfoContents)
  • in onMapClick call markerShowingInfoWindow.showInfoWindow() to force it back
  • if the above doesn't work, put markerShowingInfoWindow.showInfoWindow() inside Runnable.run() and post it with Handler or View
MaciejGórski
  • 22,187
  • 7
  • 70
  • 94
1

Not that I'm aware of. You're best bet is to create your own custom icon for the map marker that includes a drawn "infoWindow." It will then require some custom drawing on the infoWindow section of the icon bitmap to produce the same effect as a normal infoWindow, but it's not too terrible to pull off. Not quite as easy as the solution you were looking for, but it'll get you where you were wanting to go. Hope that helps!

GrimmRanger
  • 428
  • 3
  • 9
0

Assuming that you already know how to setup info windows, these lines will make your infoWindow, for any one marker, permanent:

    final Marker myMarker = mGoogleMap.addMarker(mDriverMarker);

    myMarker.showInfoWindow();

    mGoogleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
        @Override
        public void onMapClick(LatLng latLng) {
            myMarker.showInfoWindow();
        }
    });

    mGoogleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
        @Override
        public boolean onMarkerClick(Marker marker) {
            myMarker.showInfoWindow();
            return true;
        }
    });
Abdul Wasae
  • 3,614
  • 4
  • 34
  • 56