实际上,我正在使用Google APIv2开发一个安卓应用程序,到目前为止,我试图在地图上显示一些标记,而且我希望在我的相机视图中有所有的标记,为此我正在使用
LatLngBounds.Builder builder = new LatLngBounds.Builder();
LatLngBounds bounds;
int padding = 0;
//markMap is a hashmap populated with my markers positions.
HashMap<String, LatLng> markMap = new HashMap<String, LatLng>();
for (Entry<String, LatLng> entry : markMap.entrySet())
{
map.addMarker(new MarkerOptions().position(entry.getValue()));
builder.include(entry.getValue());
}
bounds = builder.build();
CameraUpdate update = CameraUpdateFactory.newLatLngBounds(bounds, padding);
map.animateCamera(update);这很好,但只有一个问题,那就是:我目前的相机变焦水平只包括标记点,但标记图标本身通常完全或部分超出范围。

有什么建议,我应该怎么做,以便我可以有一个标记图标包括在我的相机视图?
发布于 2014-08-26 14:36:34
为什么不加些填充物:
CameraUpdate update = CameraUpdateFactory.newLatLngBounds(bounds, 50);我不明白为什么CameraUpdate应该考虑标记本身的宽度。它包括坐标,而不是标记本身。
发布于 2014-08-26 14:40:10
另一种选择可以是:
CameraPosition cameraPosition =
new CameraPosition.Builder().target(ll).zoom(16).build();
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));你可以看到更多关于“相机位置”的这里。
https://stackoverflow.com/questions/25508366
复制相似问题