Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Map V2 how to set ZoomToSpan?

Tags:

android

As title, in map v1 i could use

mapController.zoomToSpan(..., ..., ...);

to include all markers on the screen.

Dose map V2 has the same method?


2013/2/22 edit:

first, get all LatLng points you want to involve on the screen.

Assume if you have 3 LatLng points, use

LatLngBounds bounds = new LatLngBounds.Builder().include(point1)
                    .include(point2).include(point3).build();

mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 50));
like image 391
user1531240 Avatar asked Feb 07 '13 08:02

user1531240


1 Answers

Try This

  map.addMarker(new MarkerOptions().position(latlng)).setVisible(true);

  // Move the camera instantly to location with a zoom of 15.
  map.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, 15));

  // Zoom in, animating the camera.
  map.animateCamera(CameraUpdateFactory.zoomTo(14), 2000, null);
like image 192
Dhamodharan.S Avatar answered Oct 16 '22 21:10

Dhamodharan.S