Android maps - Markers Bounds at the center of top half of map area
Asked Answered
S

1

4

I have Android Map Extension attached under actionBar.

I have couple of markers, lets say 2000.

Than I have ArrayList of selected 3 markers upon some constant condition, nevermind.

I want to zoom and move map to include this selected 3 markers at max possible zoom.

It's an easy task, from this forum I found an easy way to do it :

LatLngBounds bounds = new LatLngBounds.Builder().include(new LatLng(maxLat, maxLon)).include(new LatLng(minLat, minLon)).build();
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));

I have map perfectly zoomed at this 3 markers.

Now is hard part.

When I zoom at this markers I have layout that covers bottom half of map.

I want to archive the same situation but on upper half of map only.

Resizing map is not an option.

I've tried to enlarge my boundaries 2 times vertically but it doesn't help

Thank you for your help in advance

Steels answered 25/8, 2014 at 14:11 Comment(0)
J
6

GoogleMap.setPadding is what you need. Simply set bottom to half of the height of your map.

Janis answered 26/8, 2014 at 13:0 Comment(2)
This is not a good solution, I tried it with map view and bottom sheet. When I dismiss the bottom sheet the map view and markers get distorted if there are more markers. With less number of markers, can't really see the distortion.Evaporation
@Evaporation You may want to report that to Google. They can't fix bugs they don't know about. issuetracker.google.com/issues/…Diminish

© 2022 - 2024 — McMap. All rights reserved.