How To Show An Info Window Without Showing The Icon Of A Marker In Google Map
Solution 1:
You can assign the opacity of the marker to 0.
I combined @Xingang answer to achieve more better result.
marker.setAlpha(0.0f);
marker.setInfoWindowAnchor(.5f,1.0f);
Solution 2:
Wow it would be interesting to do so. I don't know if you can do that without a marker.
because the documentation of google says something like this:
An info window allows you to display information to the userwhen they tap on a marker
on a map. Bydefault, an info windowis displayed when a user taps on a marker if the
marker has a title set. Onlyone info windowis displayed at a time. If a user clicks on
another marker, the currentwindow will be hidden and the new info window will be
displayed. You can show an info window programmatically by calling showInfoWindow() on the
target marker. An info window can be hidden by calling hideInfoWindow().
But you can trick out one thing, just try to place a transparent marker image as a resource using code:
Markermarker= myMap.addMarker(newMarkerOptions()
.position(latLng)
.title("Title")
.snippet("Snippet")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.marker))); // transparent image
marker.showInfoWindow();
over R.drawable.marker
use your own marker which will be a transparent one.
Edit:
And beside this i am sure if you want to display your route information in that info window that you should use a custom infowindow
You can create your own custom infowindow
using a XML
or just using an image.
link:
small tutorial on android custom infowindow
Hope this help you.
Do let me know if that works out for you, eager to know your response.
Thank you.
Solution 3:
I was too lazy to use a transparent image as the icon, and I want to show the icon for some cases and hide it for other cases. So I moved the position of the info window lower to hide the icon.
marker.setInfoWindowAnchor(.5f, 1.0f);
BTW, marker.setVisible(false) doesn't work, because it hides the info window as well.
Post a Comment for "How To Show An Info Window Without Showing The Icon Of A Marker In Google Map"