HERE 地图:更改已走过部分路线的颜色

HERE Maps: Change color of already travelled part of route

是否可以在导航过程中更改路线的颜色? 具体来说,我希望路线中已经走过的部分与即将到来的路线部分颜色不同。现在都是一样的颜色。

您需要使用Polyline class绘制您的路径,然后您可以为其设置颜色。

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

第 3.3.x 代 HERE SDK 目前不支持此功能。

我们正尝试在即将发布的版本中添加此功能,敬请期待!

将 MapRoute 对象的 traveledColor 变量设置为透明对我有用。

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