(Android) Is it possible to change the shape of the polyline in google maps?

android, colors, google-maps, polyline, shapes

Solution

This will do?

 GoogleMap map;
 // Add a thick blue line
 Polyline line = map.addPolyline(new PolylineOptions()
     .add(new LatLng1, new LatLng2)
     .width(10)
     .color(Color.BLUE));
 // Add a thin white line
 Polyline line = map.addPolyline(new PolylineOptions()
     .add(new LatLng1, new LatLng2)
     .width(4)
     .color(Color.WHITE));

Problem

I know we can change the color of the polyline by using "polylineOptions.color(YOUR_COLOR);" bit is it possible to set a shape on it? (I would like the like to have a blue border and be white inside if the route that needs to be completed and if completed, set the color to blue -no more border) This is what I have so far, I call this function 2 times, once for the completed path and then for the path to be completed: ``` public void createProgressRouteOnMap( ArrayList<LatLng> route, boolean done){ if(done) { if(polyline != null){ polyline.remove(); } }else{ if(polyline2 != null){ polyline2.remove(); } } PolylineOptions polyLineOptions = new PolylineOptions(); polyLineOptions.addAll(route); polyLineOptions.width(10); if(done){ polyLineOptions.color(getResources().getColor(R.color.background)); }else{ polyLineOptions.color(getResources().getColor(R.color.blue_route)); } if(mMap == null){ setUpMapIfNeeded(); } if(done) { polyline = mMap.addPolyline(polyLineOptions); }else{ polyline2 = mMap.addPolyline(polyLineOptions); } } ```

Original source