谷歌地图缩放/动画没有响应

时间:2013-08-22 16:35:43

标签: android google-maps

我的某个活动有一张地图。地图运作良好。但是,我想用以下代码更改缩放和一些动画。但是,这些都没有响应。我错过了什么?谢谢!

googleMap.addMarker(new MarkerOptions().position(latLng).title(my_location.getLocationName()));

googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));

// Zoom in, animating the camera.
googleMap.animateCamera(CameraUpdateFactory.zoomIn());

// Zoom out to zoom level 10, animating with a duration of 2 seconds.
googleMap.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);

CameraPosition cameraPosition = new CameraPosition.Builder()
.target(latLng)         // Sets the center of the map to my coordinates
.zoom(17)                   // Sets the zoom
.bearing(180)                // Sets the orientation of the camera to south
.tilt(30)                   // Sets the tilt of the camera to 30 degrees
.build();                   // Creates a CameraPosition from the builder

googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

0 个答案:

没有答案