Android地图-标记边界位于地图区域上半部的中心 [英] Android maps - Markers Bounds at the center of top half of map area
问题描述
我在actionBar下附加了Android Map Extension.
I have Android Map Extension attached under actionBar.
我有几个标记,比方说2000.
I have couple of markers, lets say 2000.
在某些恒定条件下,我没有选择3个标记的ArrayList,请记住.
Than I have ArrayList of selected 3 markers upon some constant condition, nevermind.
我想缩放并移动地图,以便在最大可能缩放的情况下包括此选定的3个标记.
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));
我在这3个标记处完美地缩放了地图.
I have map perfectly zoomed at this 3 markers.
现在是困难的部分.
当我放大这些标记时,我的布局会覆盖地图的下半部分.
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.
我尝试将边界垂直扩大2倍,但这无济于事
I've tried to enlarge my boundaries 2 times vertically but it doesn't help
谢谢您的帮助
推荐答案
GoogleMap.setPadding
is what you need. Simply set bottom to half of the height of your map.
这篇关于Android地图-标记边界位于地图区域上半部的中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!