Files
MapLibreParticleLab/platform/android/docs/camera/min-max-zoom.md

1.3 KiB

Min/Max Zoom

!!! note

You can find the full source code of this example in [`MaxMinZoomActivity.kt`](https://github.com/maplibre/maplibre-native/blob/main/platform/android/MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/camera/MaxMinZoomActivity.kt) of the MapLibreAndroidTestApp.

This example shows how to configure a maximum and a minimum zoom level.

--8<-- "MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/camera/MaxMinZoomActivity.kt:zoomPreference"

Bonus: Add Click Listener

As a bonus, this example also shows how you can define a click listener to the map.

--8<-- "MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/camera/MaxMinZoomActivity.kt:addOnMapClickListener"

You can remove a click listener again with MapLibreMap.removeOnMapClickListener. To use this API you need to assign the click listener to a variable, since you need to pass the listener to that method.