I am using the following code to add markers to google map and create bounds.
What I am trying to do is add the markers and zoom in a way that all of them are visible in a map that has fixed height
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for(Location loc: locations) {
MarkerOptions marker = new MarkerOptions().position(loc.lat, loc.lon);
googleMap.addMarker(marker);
builder.include(marker.getPosition());
}
LatLngBounds bounds = builder.build();
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, 5);
googleMap.animateCamera(cameraUpdate);
Whether all icons will appear or not depends on the value I add for padding.
If I increase the value all show up. Otherwise others are hidden.
How do I come up with the correct value for the padding taking into account that my googleMap has a fixed set width?