How to zoom in/out the map view such a way that it cover all markers?
i am reviewing sample code of gmap V2 given in sdk. It lays on sdk\extras\google\google_play_services\samples\maps.
Thanks in advance.
Try using LatLngBounds
:
LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(Latlng1);
builder.include(Latlng2);
LatLngBounds bounds = builder.build();
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20));
来源:https://stackoverflow.com/questions/16414820/android-zoom-to-fit-all-markers-on-google-map-v2