Android Google Maps: disable dragging in MapFragment

前端 未结 6 854
死守一世寂寞
死守一世寂寞 2020-12-29 17:52

Can I disable drag functionality when the user tries to drag the map with his fingers without disturbing the Zoom in and Zoom out?

Any one please suggest an idea

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-29 18:20

    for disable dragging in MapFragment this code :

    googleMap.getUiSettings().setScrollGesturesEnabled(false);
    

    works as @tomrozb said. but it dosn't disable map zoom by touch on map. for that use this code beside above code:

    googleMap.getUiSettings().setZoomGesturesEnabled(false);
    

提交回复
热议问题