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.
Asked
Active
Viewed 1,316 times
3 Answers
2
Setting the traveledColor variable of the MapRoute object to transparent did the trick for me.
mapRoute?.color = ResourcesCompat.getColor(resources, R.color.colorAccent, null)
mapRoute?.traveledColor = ResourcesCompat.getColor(resources, android.R.color.transparent, null)

rsd96
- 894
- 6
- 6
1
you need to use Polyline
class to draw your path and then you can set color to it.
Polyline line = googlemap.addPolyline(new PolylineOptions()
.add(new LatLng (myLocation2.getLatitude(), myLocation2.getLongitude()), new LatLng (currentLocation.getLatitude(), currentLocation.getLongitude())).width(5)
.color(Color.RED));

Andro
- 65
- 1
- 10
-
I'm actually doing it like this with HERE maps. I'm storing traveled positions and I draw a polyline. – Teriblus Jan 28 '17 at 14:56
-
Be careful of long routes with many points if you are drawing your own polyline on top. Apply something like a douglas peuker to simplify the shape points otherwise rendering performance will suffer. – David Leong Jan 30 '17 at 18:19
-
I thought getRouteGeometry does that and returns simplified geometry already...hmmm – Andrey Suvorov Jul 28 '17 at 11:04
-
@DavidLeong Is this feature available now, with premium sdk version 3.4? I want to remove the already travelled part of route. – Akhil Tiwari Sep 06 '17 at 11:10
1
This is currently not supported with the 3.3.x generation of the HERE SDK.
This feature is something we are trying to add in an upcoming release, so stay tuned!

David Leong
- 1,662
- 1
- 11
- 7
-
Is this feature available now, with premium sdk version 3.4? I want to remove the already travelled part of route. – Akhil Tiwari Sep 06 '17 at 11:10