Is it possible to disable moving inside the google map?
9 Answers
Even though there is an accepted answer, just providing my answer as it didnt help me. mapView.setClickable(false) does not work all the time, like cases where you have a mapView inside a scrollView. So I created a view object right above the mapView of the same size.
Handled the onTouchListener for my overlay view and passed all the touch events to the parent of mapView (ScrollView in my case), hence by-passing all the touch events from mapView to scrollview.
One more way to achieve is by doing
mMap.getUiSettings().setAllGesturesEnabled(false);
-
Works for v2 map fragments too! – Aphex Nov 08 '15 at 19:27
mMap.getUiSettings().setScrollGesturesEnabled(false);
this can disable moving in map

- 2,055
- 2
- 22
- 37
You'll want to setClickable(false), but you'll also probably want to setFocusable(false) in order to prevent the MapView from getting focus.
That can be a problem when the user uses the hardware navigation buttons, because if the MapView has focus then the up-down-left-right buttons will scroll the map.

- 99,783
- 65
- 191
- 249
I created customMapView that extends MapView and override the onInterceptTouchEvent method.
public class customMapView extends MapView {
public customMapView(Context context) {
super(context);
}
public customMapView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public customMapView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
public customMapView(Context context, GoogleMapOptions googleMapOptions) {
super(context, googleMapOptions);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
// return super.onInterceptTouchEvent(ev);
return true;
}
}

- 326
- 4
- 14
We can stop user interactions with MapView or SupportMapFragment using GoogleMapOptions
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val mapOptions = GoogleMapOptions()
mapOptions.rotateGesturesEnabled(false)
mapOptions.zoomGesturesEnabled(false)
mapOptions.tiltGesturesEnabled(false)
mapOptions.scrollGesturesEnabled(false)
// Map View
val mapView = MapView(context, mapOptions)
mapView.onCreate(savedInstanceState)
// Or
val mapView = MapView(context
mapView.getMapAsync { googleMap ->
googleMap.uiSettings.setAllGesturesEnabled(false)
}
// Or Map Fragment
val mapFragment = SupportMapFragment.newInstance(mapOptions)
}

- 3,576
- 1
- 22
- 25
-
1Could you please put a comment while down voting ? Otherwise no one (especially me) will know whats wrong with this answer. – Suryavel TR Dec 12 '18 at 10:28
Not sure if i have miss understood but what solved this issue for me was as follows :)
map.HasZoomEnabled = false; map.HasScrollEnabled = false;

- 92
- 8
If you embed the map view in your app, I think you can use static maps to view the same.

- 2,395
- 3
- 30
- 35
-
-
static maps are a kind of snap shot of the map for a specific location. You can zoom in and zoom out but not much can be done. – Vinay Apr 06 '11 at 04:07
-
I added an overlay to the map and I want to drag it around but I don't want the map to move too – Vincent Apr 15 '11 at 11:33