【发布时间】:2017-05-30 17:51:22
【问题描述】:
我想将标记图标旋转到道路方向,正如您在图像中看到的那样,它只是放置但没有旋转到道路方向..我已经尝试过下面的代码
double lat = 19.205681
double lon = 72.871742
loc.setLatitude(lat);
loc.setLongitude(lon);
Location newLoc = new Location("service Provider");
newLoc.setLongitude(lat);
newLoc.setLongitude(lon);
map.addMarker(new MarkerOptions()
.position(new LatLng(data.getLat(),data.getLon()))
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_pandu_car))
.anchor(0.5f,0.5f)
.rotation(loc.bearingTo(newLoc))
.flat(true));
注意:标记有单独的位置(ofcource)我不想显示从到位置的方位...只有单独的标记要面对道路方向
更新:我想像这个 Ola 应用程序一样设置我的标记(汽车)
【问题讨论】:
-
如果你是从api中取回,上传端必须提供方位让服务器返回给你。这是因为您不想根据当前位置设置方位角,而是根据所提供位置的实际方位角设置。
标签: android google-maps google-maps-api-3 google-maps-markers