I want to move camera to position to fit LatLngBounds
with regard to marker height. So far I'm able for fit the anchors of markers with this code:
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (Marker marker : markerList) {
builder.include(marker.getPosition());
}
LatLngBounds bounds = builder.build();
int padding = getActivity().getResources().getDimensionPixelSize(R.dimen.home_map_padding); // offset from edges of the map in pixels
cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, padding);
mGoogleMap.animateCamera(cameraUpdate);
It produces output like this:
As you can see there's empty space at the bottom (this is
int padding
). I'd like to have the padding to be equal like this: