如何在两个拉特隆点之间画线?

Rjz*_*ara 1 android google-maps path google-polyline

使用折线我可以在两点之间创建一条路径。

但是当我使用这两个点(艾哈迈达巴德到纽约)时,不会创建折线。否则,如果两点之间没有 SEA,则它会起作用。

当积分像时,我遇到了问题

在此处输入图片说明

但在这种情况下,它从普杰工作到艾哈迈达巴德 在此处输入图片说明

Rjz*_*ara 5

最后我得到了OlaUber应用程序如何做这些的答案。

在此处输入图片说明

ArrayList<LatLng> points = new ArrayList<LatLng>();
                PolylineOptions polyLineOptions = new PolylineOptions();
                points.add(new LatLng(from_latitude,from_longitude));
                points.add(new LatLng(to_latitude,to_longitude));
                polyLineOptions.width(7 * 1);
                polyLineOptions.geodesic(true);
                polyLineOptions.color(activity.getResources().getColor(R.color.black));
                polyLineOptions.addAll(points);
                Polyline polyline = mMap.addPolyline(polyLineOptions);
                polyline.setGeodesic(true);
Run Code Online (Sandbox Code Playgroud)