Can I show only the info window in google map? I am developing an Android app with Google Map's V2 api. I wanted to show the route information in a info window, but I don't want to show the marker icon. So can info window be separated from a marker? If so how can I only display the info window while hiding the marker.
Thanks
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:
Google Maps for Android V2
An info window allows you to display information to the user when they tap on a marker
on a map. By default, an info window is displayed when a user taps on a marker if the
marker has a title set. Only one info window is displayed at a time. If a user clicks on
another marker, the current window 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:
Marker marker = myMap.addMarker(new MarkerOptions()
.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:
custom infowindow
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.
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);
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.