Adrian Silveanu
Adrian Silveanu

Reputation: 111

How to avoid polyline overlap with alpha shading?

Has anyone found a way to draw polylines with alpha shading on Google Maps in Android so that the color with alpha shading is uniform? I am running into a problem where multiple polylines are overlapping, which causes the whole line to have a none uniform appearance.

In the picture below, the dark blue line is the route and the much wider light blue line is the corridor: enter image description here

This the code I am using to draw the corridor:

Polyline newCorriLine = map.addPolyline(new PolylineOptions()
                           .width(toUse)
                           .color(0x7733B5E5)
                           .addAll(points)
                           .zIndex(6));

Also is there a way to round the end points so that they look like half circles, instead of a wide line that ends right at the end point?

Thank you!

Upvotes: 0

Views: 568

Answers (1)

Marcin Orlowski
Marcin Orlowski

Reputation: 75645

Since while drawing polyline you are not really in control on the whole drawing process I am really suggesting not to waste time on any trickery to make it look better - you will probably be doing this again with next update to Maps. There's many things that are poor (politely speaking) in Maps leaving it as is (IMHO) is most effective - whatever would you do is kind of hackish approach and waste of time. Fill a bug against maps if you can, and leave it to maps team to work on it.

As for endpoints - you can always add own markers to overlap end points which should work (it does for me), still you cannot control in which order polylines and markers are drawn.

Upvotes: 1

Related Questions