gpt4 book ai didi

android - 如何在 Google Maps Api v2 Android 中禁用缩小手势?

转载 作者:行者123 更新时间:2023-11-30 00:56:56 25 4
gpt4 key购买 nike

我可以使用 mMap.getUiSettings().setZoomGesturesEnabled(false) 来禁用放大/缩小手势,但是如何才能禁用缩小手势?

更新

我真正需要的是允许用户查看 map 直到指定的缩放级别。例如,如果缩放级别设置为 17,则允许用户在不离开缩放级别 17 中显示的区域的情况下放大和滚动 map ,然后再次缩小到级别 17。

最佳答案

SupportMapFragment mapView = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map));
View zoomControls = mapView.getView().findViewById(0x1);

for(int i=0;i<((ViewGroup)zoomControls).getChildCount();i++){
View child=((ViewGroup)zoomControls).getChildAt(i);
if (i==0) {
// there is your "+" button, zoom in

}
if (i==1) {
// there is your "-" button, I hide it in this example
child.setVisibility(View.GONE);
}
}

关于android - 如何在 Google Maps Api v2 Android 中禁用缩小手势?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39975985/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com