我想根据从加速度计接收到的轴承或传感器值旋转标记,以向用户显示他实际移动的位置。我已将标记图标和平面值设置为 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 或加速度计接收到的轴承值。
基本上我想让我的标记与谷歌地图标记相同,它向用户显示他们正在移动或转向的方向。