我设法在地图上追踪路线,我想要实现的是折线之间的联合是圆形的,或者描边之间没有明显的切割。
成就:
您要抵达的行:
public void onDrawRoutes(final GoogleMap mMap) throws JSONException {
final JSONArray polyline = mArray.getJSONObject(mRoute).getJSONArray("legs").getJSONObject(0).getJSONArray("steps");
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
for (int i = 0; i < polyline.length(); i ++) {
String points = null;
try {
points = polyline.getJSONObject(i).getJSONObject("polyline").getString("points");
} catch (JSONException e) {
e.printStackTrace();
}
lists.add(i, PolyUtil.decode(points));
}
return null;
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onPostExecute(Void aVoid) {
for (int j = 0; j < lists.size(); j++) {
List<LatLng> iterable = lists.get(j);
mMap.addPolyline(new PolylineOptions()
.addAll(iterable)
.width(20)
.color(mContext.getResources().getColor(R.color.ligthBlue, null)).geodesic(true));
}
}
}.execute();
}