private void drawMarkers(int markerSize) { LatLngBounds.Builder bounds = new LatLngBounds.Builder(); NativeMap.Clear(); List <LatLng> latLngList = new List <LatLng>(); foreach (var point in customMap.Points) { var latlng = new LatLng(point.Latitude, point.Longitude); latLngList.Add(latlng); /*var marker = new MarkerOptions(); * marker.Anchor(0.5f, 0.5f); * marker.SetPosition(latlng); * BitmapDescriptor pic = null; * if (!string.IsNullOrEmpty(point.PathToPicture)) * { * Bitmap bm = BitmapFactory.DecodeFile(point.PathToPicture); * if (bm != null) * { * var croppedBitmap = getCroppedBitmap(bm, markerSize); * pic = BitmapDescriptorFactory.FromBitmap(croppedBitmap); * bm = null; * croppedBitmap = null; * } * } * * if (pic == null) * { * pic = BitmapDescriptorFactory.FromResource(Resource.Drawable.place_unknown); * } * * marker.SetIcon(pic); * NativeMap.AddMarker(marker); * bounds.Include(latlng);*/ } List <PatternItem> pattern_lines = new List <PatternItem>(); pattern_lines.Add(new Gap(10)); //pattern_lines.Add(new Dash(20)); PolylineOptions lineOptions = new PolylineOptions(); foreach (var point in latLngList) { lineOptions.Add(point); } //lineOptions.InvokePattern(pattern_lines); lineOptions.InvokeWidth(10); NativeMap.AddPolyline(lineOptions); if (customMap.Points.Count > 1) { try { NativeMap.MoveCamera(CameraUpdateFactory.NewLatLngBounds(bounds.Build(), 100)); } catch (Java.Lang.Exception) { } } bounds.Dispose(); }