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

三世轮回 提交于 2020-02-12 04:55:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!