Вопрос

if we make an application to make route/path using android and google maps, we can use class DirectionPathOverlay to make line from one point to other, but i cant make the line more transparent (not 100% transparent), it makes street name cant read clearly, can anyone help me?

here some code from DirectionPathOverlay class

 public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
        Projection projection = mapView.getProjection();
        if (shadow == false) {
            Paint paint = new Paint();
            paint.setAntiAlias(true);
            paint.setStrokeJoin(Join.ROUND);
            Point point = new Point();
            projection.toPixels(gp1, point);
            paint.setColor(Color.BLUE);

            Point point2 = new Point();
            projection.toPixels(gp2, point2);
            paint.setStrokeWidth(4);
            canvas.drawLine((float) point.x, (float) point.y, (float) point2.x,
                    (float) point2.y, paint);
        }
        return super.draw(canvas, mapView, shadow, when);
Это было полезно?

Решение

Use paint.setAlpha(200); this function accepts an Integer from 0 to 255.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top