Last active
August 29, 2015 14:14
-
-
Save tolmachevroman/3426c66d96fb4c44d302 to your computer and use it in GitHub Desktop.
Fit all the markers on the map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LatLngBounds.Builder builder = new LatLngBounds.Builder(); | |
//mMarkers is a List<Marker> with your markers | |
for (Marker marker : mMarkers) { | |
builder.include(marker.getPosition()); | |
} | |
LatLngBounds bounds = builder.build(); | |
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, PADDING); //padding between screen borders and extreme right/left markers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment