屏幕旋转时旋转地图标记?

时间:2015-11-25 09:02:49

标签: android google-maps rotation google-maps-markers

使用Google Maps API v2时,我无法在Android App Rotate中制作自定义标记。我想显示Uber应用程序中发生的旋转。我在标记上设置了扁平属性,但它没有帮助。以下是摘录

select EXTRACT(MONTH FROM to_date('Nov 2015', 'Mon YYYY'))

2 个答案:

答案 0 :(得分:5)

您可以使用承载的设备或遵循此tutorial

来实现

创建一个非常适合承载更新的标记。

private Marker marker;

// Create this marker only once; probably in your onMapReady() method
marker = mGoogleMap.addMarker(new MarkerOptions()
        .position(new LatLng(myLatitude, myLongitude))
        .flat(true));

使用getBearing()对象

中的Location方法获取方位更新
  if (mLastLocation.hasBearing()) {
     marker.setRotation(mLocation.getBearing());
    }
     //if following the linked tutorial
    // marker.setRotation((float) azimuth);

在您使用时也了解this

答案 1 :(得分:0)

你可以尝试这样

Marker marker = map.addMarker(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.vehicle_marker)).flat(true).anchor(0.5f,0.5f).rotation(180));