AB'*_*AB' 1 google-maps google-maps-android-api-2
我正在使用Google Maps开发应用程序,并且想要更改地图中折线的样式。我想将折线的颜色更改为渐变线,如何在android中做到这一点
您可以使用我的richmaps库:https : //github.com/antoniocarlon/richmaps
您可以像这样轻松地创建渐变折线:
RichPolylineOptions polylineOpts = new RichPolylineOptions(null)
.zIndex(3) // zIndex represents the position of the polyline on the RichLayer
.strokeWidth(15)
.strokeColor(Color.YELLOW) // Set the polyline base color
.linearGradient(true)
.add(new RichPoint(new LatLng(40.22987, -3.95931)).color(Color.RED)) // Set color for some vertices
.add(new RichPoint(new LatLng(40.23109, -3.95926)))
.add(new RichPoint(new LatLng(40.23063, -3.95837)).color(Color.RED))
.add(new RichPoint(new LatLng(40.23169, -3.95809)))
.add(new RichPoint(new LatLng(40.23093, -3.95705)))
.add(new RichPoint(new LatLng(40.23023, -3.95626)));
RichPolyline polyline = polylineOpts.build();
polyline.add(new RichPoint(new LatLng(40.23163, -3.95602)).color(Color.CYAN)); // RichPoint added after the creation of the RichPolyline
richLayer.addShape(polyline);
Run Code Online (Sandbox Code Playgroud)