【发布时间】:2014-08-27 15:42:21
【问题描述】:
所以,我在我的 Android 应用程序上的 Google 地图上显示了从 A 点到 B 点的路线。这一切都很好。我现在正在做的是通过这样做来缩放以适应地图上的两个标记:
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (LatLng marker : markerPoints) {
builder.include(marker);
}
LatLngBounds bounds = builder.build();
int padding = 20; // offset from edges of the map in pixels
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds,
padding);
map.moveCamera(cu);
map.animateCamera(cu);
问题是这不包括折线,所以如果路线超出屏幕,它会切断折线,如下所示:
关于如何缩放以适应折线的任何想法?谢谢!
【问题讨论】:
标签: java android google-maps