Draw dotted polyline on Google Map - Android

Ancuta picture Ancuta · Dec 28, 2016 · Viewed 9.4k times · Source

I am working on an Android application that uses Google Maps and draws polylines on the map. I wanted to know if there is a way to draw a dotted polyline (similar to the one Google Maps shows when displaying a walking route) and how should I do that.

I have looked into the PolylineOptions object but I didn't find a method that would help me.

Is there a way do draw a dotted polyline? If so what is the method?

Thanks.

Answer

xomena picture xomena · Mar 14, 2017

As of February 2017, Google released a new set of customizations for polylines and polygons in Google Maps Android API v2. Now you can create dashed or dotted polylines.

See information about new features in the Shapes Guide. See an example in the Polylines and Polygons tutorial.

You can also read the corresponding blog post here:

https://maps-apis.googleblog.com/2017/02/styling-and-custom-data-for-polylines.html