Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable pan/zoom in com.google.android.maps.MapView

How can i disable the panning/zooming functionality of a MapView (not the zoom controls, i want a wholly static map)?

I've also noticed that touching the map doesn't seem to trigger the MapView onClickListener, could anyone elaborate why?

like image 968
Juliusz Avatar asked Sep 01 '10 07:09

Juliusz


People also ask

How can we enable or disable the zoom in the map in Android Studio?

The Maps API provides built-in zoom controls that appear in the bottom right hand corner of the map. These are disabled by default, but can be enabled by calling UiSettings. setZoomControlsEnabled(true) .

How do I change the zoom level on Google Maps?

You can change the zoom level of the map using simple steps. Step 1 Go to Add or Edit Map page . Step 2 Select 'Default zoom level' in the 'Map Information section'. Step 3 click save map and see the changes.

How do I pan Google Maps?

To pan around on a map, you can use the arrow keys to move north, south, east and west. You can also press two arrow keys together to move diagonally.


2 Answers

For version 2 of the Google Maps API for Android, this is the way:

map.getUiSettings().setScrollGesturesEnabled(false);
like image 101
Sveinung Kval Bakken Avatar answered Oct 01 '22 02:10

Sveinung Kval Bakken


This is gauranteed to work

mapView.getMap().getUiSettings().setAllGesturesEnabled(false);
like image 27
Taranfx Avatar answered Oct 01 '22 03:10

Taranfx