sat70
sat70

Reputation: 51

Android Google Map min zoom

I have implemented a Google Map Api v2 in my Android App with zoom control.

map.getUiSettings().setZoomControlsEnabled(true);

I'd like to zoom out to view the entire world but it seems the min zoom level is set to 2 or higher. Is there any way to achieve this behavior ? Thanks in advance!!!

Upvotes: 1

Views: 3093

Answers (1)

Nima
Nima

Reputation: 6563

Yes, you can work around this by listening to camera change and reset zoom when needed.

    map.setOnCameraChangeListener(this);

    @Override
    public void onCameraChange(CameraPosition position) {
      float maxZoom = 17.0f;
      float minZoom = 2.0f;

      if (position.zoom > maxZoom) {
        map.animateCamera(CameraUpdateFactory.zoomTo(maxZoom));
      } else if (position.zoom < minZoom) {
      map.animateCamera(CameraUpdateFactory.zoomTo(minZoom));
     }
   }

Upvotes: 3

Related Questions