【发布时间】:2015-06-29 22:29:13
【问题描述】:
有谁知道我可以像谷歌地图应用一样使用地图 API v2 自动旋转地图吗?我是否必须自己实现此功能,还是在 API 中但我没有看到它?
【问题讨论】:
标签: android google-maps android-maps-v2
有谁知道我可以像谷歌地图应用一样使用地图 API v2 自动旋转地图吗?我是否必须自己实现此功能,还是在 API 中但我没有看到它?
【问题讨论】:
标签: android google-maps android-maps-v2
是的,您可以使用很多参数来更改视图,您可以在此处查看文档: 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 是半看地平线。
希望这会有所帮助。
【讨论】: