Google Maps Android MapView v2:禁用缩放

有没有办法在MapView禁用缩放(捏和双击),但保持滚动?

这意味着将clickable设置为false将不起作用。

我也尝试在activity设置onTouch listener ,但不会触发使用:

 mapView.setOnTouchListener(this); 

您可以使用XML文件分配这些属性:

  map:uiRotateGestures="true" map:uiScrollGestures="true" map:uiTiltGestures="true" map:uiZoomGestures="true" 

所以使用:

  map:uiZoomGestures="false" 

MapFragment对象上。

 import com.google.android.gms.maps.GoogleMap; public void onMapReady(GoogleMap map) { ... map.getUiSettings().setZoomGesturesEnabled(false); 

Ui设置文档

你也可以尝试一些这样的事情..

注意:此方法禁用Google地图界面的放大/缩小功能

以上两个答案是正确的,根据问题。 感谢大卫更新我。

 GoogleMap myMap; myMap.getUiSettings().setZoomControlsEnabled(false); 

有关Google地图界面可用的更多公共方法..

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

这里是Kotlin的例子:

 map.uiSettings.setAllGesturesEnabled(false) 
Interesting Posts