Set width for PathOverlay lines (OSMDroid)

Does anyone know how to set the line width for the PathOverlay element in OSMDroid?

The PathOverlay class itself really doesn't have anything useful in this arena. I am trying to get into Paint and Canvas using the DrawOverlay draw method. The android.graphics.Paint class has a setStrokeWidth (float) method, but this does not affect the line width.

Looking through the Paint API, there isn't much else out there that helps; also for the canvas.

+3


source to share


1 answer


Try the following (you can adapt to your requirements);

    pathOverlay = new PathOverlay(Color.GREEN, context);
    ArrayList<GeoPoint> path = getTrackPoints();
    mMapView.getOverlays().add(pathOverlay);
    Paint pPaint = pathOverlay.getPaint();
    pPaint.setStrokeWidth(5);
    pathOverlay.setPaint(pPaint);

      



If you get Paint settings from overlay and then just change the width, that solves the worry of other Paint settings.

+7


source







All Articles