【发布时间】:2023-04-05 00:26:01
【问题描述】:
我正在使用这些设置来创建从一个位置到另一个位置的方向:
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.width(15);
polylineOptions.color(colorPrimary);
mMap.addPolyline(polylineOptions.addAll(points));
在地图上,它看起来像这样:
如何在没有中断的情况下从一个点到另一个点画一条连续的线?
这是获取积分的代码:
if (direction != null) {
List<Route> routes = direction.routes;
Route route = routes.get(0);
List<Leg> legs = route.legs;
Leg leg = legs.get(0);
List<Step> steps = leg.steps;
for (Step step : steps) {
String point = step.polyline.points;
List<LatLng> points = PolyUtil.decode(point);
}
}
【问题讨论】:
-
显示您的
points。你在折线上添加了什么? -
@MaratZangiev
points是List<LatLng>的列表。不正确吗? -
是的,没错。提供您的代码
points。points变量里面是什么? -
@MaratZangiev 请查看我更新的问题。
-
在您提供的代码中,您的
points变量是在for-loop 中创建的。您确定上面代码中的变量是points吗? (不是)
标签: android google-maps google-maps-api-3 android-maps google-directions-api