在Android中自动旋转Google地图

时间:2015-06-29 22:29:13

标签: android google-maps android-maps-v2

有人知道我如何使用地图API v2自动旋转地图,就像谷歌地图应用程序一样吗?我是否必须自己实现此功能,或者它是否在API中,我只是没有看到它?

1 个答案:

答案 0 :(得分:0)

是的,您可以使用大量参数更改视图,在这里您可以看到文档: https://developers.google.com/maps/documentation/android/views 只更改旋转的示例可以是:

CameraPosition cameraPosition = new CameraPosition.Builder()        
    .bearing(90)                // Sets the orientation of the camera to east
    .tilt(30)                   // Sets the tilt of the camera to 30 degrees
    .build();                   // Creates a CameraPosition from the builder
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

其中轴承是北方顺时针方向的旋转(不是实际轴承,它是绝对方向),而倾斜是视图的倾斜度,0是地图的顶部,45是半视地平线。

希望这会有所帮助。