I need to add extra padding around the markers on the map that I show.
Here is the code so far but the top and bottom or west and east markers are on the edge of the screen.
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
@Override
public void onMapLoaded() {
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (int i = 0; i < arrayList.size(); i++) {
options.position(latlngs.get(i));
options.title(arrayList.get(i).getArea().toString());
options.snippet(arrayList.get(i).getRegion().toString());
mMap.addMarker(options);
builder.include(latlngs.get(i));
}
LatLngBounds bounds = builder.build();
int padding = 0;
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, padding);
mMap.moveCamera(cameraUpdate); }
});
}
Here is what I get:
This is what I want: So how can I add some padding so that I can see all the markers but not have the markers butted against the edge of the map? Thanks for any input.
Set padding value > 0
Example:int padding = 50;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With