I'm trying to disable the zoom and pan the mapview in a mapbox. I use mapbox 0.4.0. Currently I can disable the zoom, but cannot disable the pan
MapView mv = (MapView) tab.findViewById(R.id.mapid);
mv.setZoom(14);
mv.setMaxZoomLevel(14);
mv.setMinZoomLevel(14);
I needed to do the same thing, But there is nothing relevant functionality I found in the MapBox sdk. So, I figure out something on my own. I customized MapView of MapBox sdk with enabling/disabling pan feature. For that I used SimpleTwoFingerDoubleTapDetector . Thanks @Sam for this above class which helps me to detect two finger double tap.
My custom MapView class:
MyMapView.java:
So, now when you'll access your mapview in your Activity :
It might help someone. :)
In the current version (4.1), this should probably do:
Or if you want to get rid of interaction completely:
Just override the
OnTouch
returningtrue
:Unfortunately, the only solution is to put a transparent view on top of the map that will consume the touches. I use a
Button
with a transparent background. At this point MapBox still hasn't allowed devs to disable user interaction.