屏幕上的中心Google路线



我想将一个从屏幕上的Google Direction API返回的路由中心吗?我尝试使用cameraupdateFactory.newlatlngbounds,但似乎限制了用户移动到地图的某个部分。

我要做的就是向屏幕上的中心而不是我当前位置显示的路线?

好,

,如果有人需要帮助,我设法找到了一个解决方案。尽管我仍在尝试修复计算缩放问题,但它不会放大以使屏幕中的路由适合用于硬编码Zoom值

LatLng northEast = new LatLng(aBoundary.getNortheast().getLat(), aBoundary.getNortheast().getLng());
LatLng southWest = new LatLng(aBoundary.getSouthwest().getLat(), aBoundary.getSouthwest().getLng());
LatLngBounds latLngBounds = new LatLngBounds(southWest, northEast);
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLngBounds.getCenter(), mGoogleMap.getCameraPosition().zoom));

aBoundary对象是响应中 Route对象内部的 Bounds对象。

最新更新