Max/Min Zoom
Note
You can find the full source code of this example in MaxMinZoomActivity.kt
of the MapLibreAndroidTestApp.
This example shows how to configure a maximum and a minimum zoom level.
Bonus: Add Click Listener
As a bonus, this example also shows how you can define a click listener to the map.
maplibreMap.addOnMapClickListener {
if (this::maplibreMap.isInitialized) {
maplibreMap.setStyle(Style.Builder().fromUri(TestStyles.AMERICANA))
}
true
}
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.