Hi, coming from OSMdroid we had two controls on our map to zoom in and out via a finger tap. Here is an example image (see bottom). Is there any possibility to show any built-in zoom controls on a Maps SDK map?
Solved! Go to Solution.
You can use setViewpointScale to animate to map to perform a zoom in or zoom out. API ref: Link
zoomInButton.setOnClickListener {
lifecycleScope.launch {
val newScale = mapView.mapScale.value / 2
mapView.setViewpointScale(newScale)
}
}
zoomOutButton.setOnClickListener {
lifecycleScope.launch {
val newScale = mapView.mapScale.value * 2
mapView.setViewpointScale(newScale)
}
}
You can use setViewpointScale to animate to map to perform a zoom in or zoom out. API ref: Link
zoomInButton.setOnClickListener {
lifecycleScope.launch {
val newScale = mapView.mapScale.value / 2
mapView.setViewpointScale(newScale)
}
}
zoomOutButton.setOnClickListener {
lifecycleScope.launch {
val newScale = mapView.mapScale.value * 2
mapView.setViewpointScale(newScale)
}
}