简体   繁体   English

这里地图:更改路线已行进部分的颜色

[英]HERE Maps: Change color of already travelled part of route

Is it possible to change the color of the route during navigation? 导航期间可以更改路线的颜色吗? Specifically I would like the already travelled parts of the route to be a different color then the upcoming parts of the route. 具体来说,我希望路线已行驶的部分与即将行驶的部分具有不同的颜色。 Right now it is all the same color. 现在,它们都是相同的颜色。

you need to use Polyline class to draw your path and then you can set color to it. 您需要使用Polyline类绘制路径,然后可以为其设置颜色。

 Polyline line = googlemap.addPolyline(new PolylineOptions()
     .add(new LatLng (myLocation2.getLatitude(), myLocation2.getLongitude()), new LatLng (currentLocation.getLatitude(), currentLocation.getLongitude())).width(5)
     .color(Color.RED)); 

This is currently not supported with the 3.3.x generation of the HERE SDK. 3.3.x版本的HERE SDK当前不支持此功能。

This feature is something we are trying to add in an upcoming release, so stay tuned! 我们正在尝试在即将发布的版本中添加此功能,敬请期待!

Setting the traveledColor variable of the MapRoute object to transparent did the trick for me. 将MapRoute对象的traveledColor变量设置为透明对我有用。

mapRoute?.color = ResourcesCompat.getColor(resources, R.color.colorAccent, null)
mapRoute?.traveledColor = ResourcesCompat.getColor(resources, android.R.color.transparent, null)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM