我想将相机移动到适合LatLngBounds的位置以适应标记高度.到目前为止,我能够使用此代码拟合标记的锚点:@H_502_2@
@H_502_2@
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (Marker marker : markerList) {
builder.include(marker.getPosition());
}
LatLngBounds bounds = builder.build();
int padding = getActivity().getResources().getDimensionPixelSize(R.dimen.home_map_padding); // offset from edges of the map in pixels
cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds,padding);
mGoogleMap.animateCamera(cameraUpdate);
最佳答案