Android and GoogleMaps: disable the mapView dragging

大兔子大兔子 提交于 2020-01-17 07:39:10

问题


Android and GoogleMaps: Can I disable the mapView dragging without disable the pinch to zoom function? Thx for answer


回答1:


Use GestureDetector and SimpleOnGestureListener, use onFling() to detect the distance between the path user did with his finger from the first touch till the release with .getX() and getY() from each MotionEvent and do nothing for x > SOMEMAXVALUE and y > SOMEMAXVALUE. I hope you'll find your way.




回答2:


I suggest overridding dispatchDraw() in MapView class and check if the center is the one you want. Use getController().setCenter(...) to recenter the map. Just an alternative to what other people suggested.



来源:https://stackoverflow.com/questions/6802796/android-and-googlemaps-disable-the-mapview-dragging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!