public void setZoom(List<LatLng> coords){
GoogleMap map = getMap();
LatLngBounds bounds = helper.getBounds(coords);
int zoom_padding = 20;
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, zoom_padding));
}
public LatLngBounds getBounds(List<LatLng> coords){
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for(LatLng coord:coords){
builder.include(coord);
}
return builder.build();
}
easy!
Mostrando entradas con la etiqueta mapfragment. Mostrar todas las entradas
Mostrando entradas con la etiqueta mapfragment. Mostrar todas las entradas
miércoles, 19 de junio de 2013
Fit map zoom to markers
Exists an easy way in Google Map API v2 to get the correct zoom for all the markers we have in the map:
Suscribirse a:
Entradas (Atom)