Reputation: 5644
Is there a way to disable the zooming (pinch and double tap) in the MapView
but keep the scrolling?
This means setting clickable to false would not work.
I have also tried setting an onTouch listener
in the activity
but it will not trigger using:
mapView.setOnTouchListener(this);
Upvotes: 10
Views: 12539
Reputation: 2296
If you're looking for a solution in Google Maps for Compose you can use this one:
GoogleMap(
modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState,
uiSettings = MapUiSettings(
scrollGesturesEnabled = false,
zoomGesturesEnabled = false,
zoomControlsEnabled = false
)
)
Upvotes: 0
Reputation: 1296
here is example on Kotlin:
map.uiSettings.setAllGesturesEnabled(false)
Upvotes: 4
Reputation: 152927
import com.google.android.gms.maps.GoogleMap;
public void onMapReady(GoogleMap map) {
...
map.getUiSettings().setZoomGesturesEnabled(false);
Upvotes: 27
Reputation: 3596
U may also try some thing like that ..
NOTE : this method disables zoom in / out functionality for Google map UI
Above two answer is correct as per question asked. Thanks David for updating me.
GoogleMap myMap;
myMap.getUiSettings().setZoomControlsEnabled(false);
For more public methods available for Google Map UI ..
Upvotes: 1
Reputation: 41129
You can assign those properties using the XML
file:
map:uiRotateGestures="true"
map:uiScrollGestures="true"
map:uiTiltGestures="true"
map:uiZoomGestures="true"
So use:
map:uiZoomGestures="false"
On the MapFragment
object.
Upvotes: 9