Reputation: 9924
So how could I change my polyline's actual color to a transparent version of it?
There's no setAlpha() or alpha() function for polyline just like for a Marker. So I tought I could simple ask the color of the polyline, make it transparent then re-set the new color.
If I use getColor() on polyline I get ints like this:
-4540819
I estimated some data like this: (So I could change the 'ff' values)
0xff222345 (for example)
Line segment color in ARGB format, the same format used by Color. The default value is black (0xff000000).
So how could I make this work?
Upvotes: 1
Views: 887
Reputation: 2682
This snippet demonstrates how to make your polyline transparent. Just change aa
to your desired transparency in hex.
map.addPolyline(new PolylineOptions()
.add(new LatLng(90, -90))
.color(0xaa222345);
Upvotes: 1
Reputation: 183
Try this code:
map.addPolyline(new PolylineOptions()
.add(new LatLng(-37.81319, 144.96298), new LatLng(-31.95285, 115.85734))
.color(ContextCompat.getColor(context, R.color.transparent_color)));
Where R.color.transparent_color is
<color name="transparent_color">#00000000</color>
In your resources.
Upvotes: 0