Android And GoogleMaps: Disable The MapView Dragging
Android and GoogleMaps: Can I disable the mapView dragging without disable the pinch to zoom function? Thx for answer
Solution 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.
Solution 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.
Post a Comment for "Android And GoogleMaps: Disable The MapView Dragging"