Google Maps Android MapView v2: disable zooming

后端 未结 4 1434
北恋
北恋 2020-12-19 03:36

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

相关标签:
4条回答
  • 2020-12-19 03:56

    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 ..

    https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/UiSettings#setZoomControlsEnabled(boolean)

    0 讨论(0)
  • 2020-12-19 04:12
    import com.google.android.gms.maps.GoogleMap;
    
    public void onMapReady(GoogleMap map) {
    ...
    map.getUiSettings().setZoomGesturesEnabled(false);
    

    UiSettings Documentation

    0 讨论(0)
  • 2020-12-19 04:12

    here is example on Kotlin:

    map.uiSettings.setAllGesturesEnabled(false)
    
    0 讨论(0)
  • 2020-12-19 04:13

    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.

    0 讨论(0)
提交回复
热议问题