Max/Min Zoom
This example shows how to configure a maximum and a minimum zoom level.
kotlin
mapMetricsMap.setMinZoomPreference(3.0)
mapMetricsMap.setMaxZoomPreference(5.0)
Bonus: Add Click Listener
As a bonus, this example also shows how you can define a click listener to the map.
kotlin
mapMetricsMap.addOnMapClickListener {
if (this::mapMetricsMap.isInitialized) {
mapMetricsMap.setStyle(Style.Builder().fromUri(TestStyles.AMERICANA))
}
true
}
You can remove a click listener again with MapMetricsMap.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.