如何在我的地图上为我的路线驾驶{j}添加InfoWindow
,例如Google地图应用
我试图像这样创作:
googleMaps.setOnPolylineClickListener(new GoogleMap.OnPolylineClickListener() {
@Override
public void onPolylineClick(Polyline polyline) {
for (LatLng pathCoordinates : polyline.getPoints()) {
googleMaps.getProjection().toScreenLocation(pathCoordinates);
Double A = pathCoordinates.latitude;
Double B = pathCoordinates.longitude;
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(new LatLng(A, B));
Marker marker = googleMaps.addMarker(markerOptions);
marker.showInfoWindow();
}
}
});
但请告诉我:
我如何管理我的代码?