Ich sah dies im Web So habe ich bestätigt, dass es möglich ist, 2 verschiedene Polylinien in einem Pfad in Google Maps zu füllen.Polyline auf Straßenrand in Android Google Maps
Um dies zu experimentieren, habe ich versucht, mit diesem Code zunächst nur eine Polylinie hinzuzufügen:
public static void drawEncodedPolyOnMap(String encoded, GoogleMap map) {
List<LatLng> points = new ArrayList<>();
int index = 0, len = encoded.length();
int lat = 0, lng = 0;
while (index < len) {
int b, shift = 0, result = 0;
do {
b = encoded.charAt(index++) - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lat += dlat;
shift = 0;
result = 0;
do {
b = encoded.charAt(index++) - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lng += dlng;
LatLng p = new LatLng((((double) lat/1E5)),
(((double) lng/1E5)));
points.add(p);
}
map.addPolyline(new PolylineOptions().width(7).color(Color.RED).geodesic(true).addAll(points));
}
Aber es gibt mir nicht die Anzeige, die ich
Grundsätzlich erwartet Mein Fall, Polylinien werden in der Mitte ausgerichtet, obwohl die Markierungen am Rand der Straße sind, der Fall, den ich nicht mag.
Ist es möglich, die Polylinie mit den Markern in Android auszurichten? Wie?