0

是否可以在 GoogleMap API 2 中禁用/启用多点触控缩放?我喜欢在必要时以编程方式禁用或启用它。谢谢

4

2 回答 2

0

要禁用多点缩放,您可以在XML文件中使用它:

map:uiZoomGestures="true"

您必须添加地图命名空间才能像这样使用它:

 xmlns:map="http://schemas.android.com/apk/res-auto"

在您的片段 xml 代码中:

 <fragment
     xmlns:map="http://schemas.android.com/apk/res-auto"
     android:id="@+id/map"
     android:name="com.google.android.gms.maps.SupportMapFragment"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     map:uiZoomGestures="true"

同样可以在JAVA代码中完成:

map.getUiSettings().setZoomGesturesEnabled(false);
于 2013-04-28T08:33:22.710 回答
0

多点触控缩放通常在系统级别处理。你可以有一个开关来打开/关闭缩放,但不是专门的多点触控(据我所知)。

您应该能够通过以下方式切换缩放:

disableScrollWheelZoom();

和:

enableScrollWheelZoom();

您可以检查用户代理(移动)并默认禁用它,然后提供启用它的选项。

于 2013-04-28T03:35:09.127 回答