In our application, a lot of markers are drawn in different locations and in certain cases at a certain zoom level, markers overlap each other. So when I click on the marker, I expect the top marker's onMarkerClick
to be fired but instead it is fired for the last hidden marker i-e the last marker, with no markers behind it.
What do you suggest I do? Also, I have no info windows, therefore I return true
from onMarkerClick
method.
Long press the marker to enable dragging. When you take your finger off the screen, the marker will remain in that position. Markers are not draggable by default. You must explicitly set the marker to be draggable either with MarkerOptions.
Try Sample // To add the marker to the map, call setMap(); marker. setMap(map);
For adding a custom marker to Google Maps navigate to the app > res > drawable > Right-Click on it > New > Vector Assets and select the icon which we have to show on your Map. You can change the color according to our requirements. After creating this icon now we will move towards adding this marker to our Map.
I found the solution here: https://github.com/googlemaps/android-maps-utils/issues/26
mGoogleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter()
{
@Override
public View getInfoWindow(Marker marker)
{
// Empty info window.
return new View(getApplicationContext());
}
@Override
public View getInfoContents(Marker marker)
{
return null;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With