I am trying to show a marker similar to the ones circled in red in the picture below. The way they behave is that they are visible up to a certain zoom, and disappears when zoomed out beyond that. I can probably programmatically hide them past a certain zoom, but I was wondering if Google Maps Android API had support for these special markers built in. Thanks.
-
post your code so that we can help you – Rahul Chaudhary Dec 05 '15 at 08:25
3 Answers
The closest thing to a built-in feature for showing/hiding markers at different zoom levels is the marker clustering implementation in the android-maps-utils library.
See this Activity in the demo app in particular for an implementation of clustered markers with custom icons:
The result can be seen below - on the left, several icons are hidden and clustered into a single "parent" icon when zoomed out, and the parent icon has a count in the middle for the number of clustered children. When you zoom in (right), you can see that these children icons are unclustered and shown separately as their own individual icons.

- 11,496
- 8
- 58
- 111
This can be easily done using zoom listeners and setVisible functions.
Checkout this SO post for coding details:
How to make a marker appear or disappear based on zoom level on Google Maps v2
-
You're linking to a javascript example for Google Maps API v3 for the web - the question is in context of the Android Maps API v2. – Sean Barbeau Dec 07 '15 at 20:57
-
-
Thank you, this link had what I needed. Relevant part: `@Override public void onCameraChange(CameraPosition cameraPosition) { marker.setVisible(cameraPosition.zoom > 7); }` – Kahtaf Alam Dec 30 '15 at 21:41
The following code can be used for a custom marker:
Marker melbourne = mMap.addMarker(new MarkerOptions()
.position(MELBOURNE)
.title("Melbourne")
.snippet("Population: 4,137,400")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.custom_marker)));

- 435
- 1
- 4
- 13