我希望根据从加速度计接收到的方位或传感器值旋转标记,以向用户显示他实际上正在移动的位置。我已将标记图标和平坦值设置为true,但它不能按照要求工作。
mCurrentLocationMarker.position(new LatLng(
LocationUtils.sLatitude, LocationUtils.sLongitude));
mCurrentLocationMarker.icon(icon);
mCurrentLocationMarker.flat(true);
mCurrentLocationMarker.rotation(LocationUtils.sBearing);
if (currentMarker != null) {
currentMarker.setPosition(new LatLng(
LocationUtils.sLatitude,
LocationUtils.sLongitude));
} else {
currentMarker = mGoogleMap
.addMarker(mCurrentLocationMarker);
}
animateCameraTo(true);
我使用这个作为标记。
我不知道为什么它不会根据用户的方向旋转。如果有人有任何想法,请帮助我找出我的错误所在。
LocationUtils.sBearing是我从onLocationChanged或加速度计接收到的方位值。
基本上,我想让我的标记与谷歌地图标记相同,显示用户移动或转向的方向。