我正在使用谷歌地图开发应用程序,我想在地图中更改折线的样式。我想将折线的颜色改为渐变线,如何在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);
如果您正在寻找准确的绘图和跟踪,您可以给this library一个镜头