问题
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
回答1:
GoogleMap.setPadding is what you need. Simply set bottom to half of the height of your map.
来源:https://stackoverflow.com/questions/25487861/android-maps-markers-bounds-at-the-center-of-top-half-of-map-area