Polyline change color dynamically - GoogleMap

1.3k Views Asked by At

I'd like to change the color of a polyline dynamically. The polylines are added to the GoogleMap using the following code:

//Add the polylines to Maps.
for (PolylineOptions polylineOptions : options) {
    if (!isFinishing()) { 
        polyLines.add(mGoogleMap.addPolyline(polylineOptions));
        this.polyLinesOptions.add(polylineOptions);
    }
}

The Polylines are decoded into PolylineOptions. I'm wondering how I can change the color of a polyline. For example gray out polylines from the route where we've already been. I've tried changing the color attribute of the PolylineOption and setColor of the PolyLine itself but nothing seems to work.

1

There are 1 best solutions below

0
On

Use following method to change polyline color polyLines.color(Color.GREEN);