我想为 MapView 相机设置动画,但想保留已设置的方位和倾斜使用。
我尝试了以下代码:
float bearing = map.getCameraPosition().bearing;
float tilt = map.getCameraPosition().tilt;
map.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder()
.target(new LatLng(
(mapBoundsBuilder.build().northeast.latitude + mapBoundsBuilder
.build().southwest.latitude) / 2,
(mapBoundsBuilder.build().northeast.longitude + mapBoundsBuilder
.build().southwest.longitude) / 2))
.zoom(map.getCameraPosition().zoom).bearing(bearing)
.tilt(tilt).build()));
// Set mapView camera to include all locations in mapBoundsBuilder.
// Set width and height to screen size. Set padding to 50 px,
// duration to 2 sec.
map.animateCamera(CameraUpdateFactory.newLatLngBounds(
mapBoundsBuilder.build(), size.x, mapViewHeight,
CAMERA_PADDING), 2000, null);
但这并不能保持方位和倾斜。