【问题标题】:Auto rotate Google map in android在android中自动旋转谷歌地图
【发布时间】:2015-06-29 22:29:13
【问题描述】:

有谁知道我可以像谷歌地图应用一样使用地图 API v2 自动旋转地图吗?我是否必须自己实现此功能,还是在 API 中但我​​没有看到它?

【问题讨论】:

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


    【解决方案1】:

    是的,您可以使用很多参数来更改视图,您可以在此处查看文档: 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 是半看地平线。

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2011-09-20
      • 1970-01-01
      • 1970-01-01
      • 2012-12-28
      • 1970-01-01
      • 1970-01-01
      • 2016-09-29
      • 2015-06-15
      • 2012-05-20
      相关资源
      最近更新 更多