我的要求是MAX_ZOOM_LEVEL = 14
。
使用边界计算缩放比MAX_ZOOM_LEVEL更大。
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
if (i < maxNearestMarkers) {
boundsBuilder.include(marker.getPosition());
}
CameraUpdate boundCameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, width,height,padding);
map.animateCamera(boundCameraUpdate);
CameraUpdate类
public final class CameraUpdate {
private final zzd zzaRp;
CameraUpdate(zzd remoteObject) {
this.zzaRp = (zzd)zzx.zzz(remoteObject);
}
public zzd zzzH() {
return this.zzaRp;
}
}
所以如何在将相机设置为新的CameraUpdate之前获得缩放级别。
我在map.animateCamera(boundCameraUpdate);
如果cameraUpdate.zoom&gt; MAX_ZOOM_LEVEL
然后cameraUpdate.zoom = MAX_ZOOM_LEVEL
THANKSSS
注意:已经这样做了,但它已放大并反弹回MAX_ZOOM_LEVEL
@Override
public void onCameraChange(CameraPosition cameraPosition) {
mZoom = cameraPosition.zoom;
Log.d("Zoom", String.valueOf(cameraPosition.zoom));
if (cameraPosition.zoom > MAX_ZOOM_LEVEL) {
map.animateCamera(CameraUpdateFactory.zoomTo(MAX_ZOOM_LEVEL));
}
}