如何同时改变方向旋转地图 [英] How to rotate the map while changing direction

查看:175
本文介绍了如何同时改变方向旋转地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序集成的谷歌地图。我能找到我的当前位置。
我想映射到自动旋转当我改变的方向。我怎样才能做到这一点。

I have integrated Google map in my application. I am able to find my current location. I want map to auto rotate when i change the direction. How can i achieve this.

感谢

推荐答案

警告:不是专家

根据谷歌API文档,听起来像是你需要调整轴承,如在<一个描述href=\"https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/GroundOverlay.html#setBearing%28float%29\"相对=nofollow>的GroundOverlay#setBearing 。

Based on Google API docs, sounds like you need to adjust the bearing, such as described in GroundOverlay#setBearing.

公开final类的GroundOverlay

一个地面叠加是被固定到地图图像。地面叠加层
  具有下列性质:

A ground overlay is an image that is fixed to a map. A ground overlay has the following properties:

...

轴承

这在图像应该以顺时针方向转动的量。旋转的中心将是图像的锚。这个
  是可选的,默认轴承是0,即该图像被对准
  使起来就是北方。

The amount that the image should be rotated in a clockwise direction. The center of the rotation will be the image's anchor. This is optional and the default bearing is 0, i.e., the image is aligned so that up is north.

例如:

GoogleMap map = ...; // get a map.
BitmapDescriptor image = ...; // get an image.
LatLngBounds bounds = ...; // get a bounds
// Adds a ground overlay with 50% transparency.
GroundOverlay groundOverlay = map.addGroundOverlay(new GroundOverlayOptions()
   .image(image)
   .positionFromBounds(bounds)
   .transparency(0.5));

这篇关于如何同时改变方向旋转地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆