Drawing an empty polygon given a set of points on a Map Overylay (Android 2.1)

后端 未结 1 1265
长发绾君心
长发绾君心 2021-01-03 15:08

I\'ve set of n points and I want to draw a n-sided polygon using these points.

I tried using android.graphics.path (please see below).

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-03 15:26

    Define a Paint object:

    Paint mPaint = new Paint();
    mPaint.setStrokeWidth(2);  //2 pixel line width
    mPaint.setColor(0xFF097286); //tealish with no transparency
    mPaint.setStyle(Paint.Style.STROKE); //stroked, aka a line with no fill
    mPaint.setAntiAlias(true);  // no jagged edges, etc.
    

    Then draw the path with:

    yourCanvas.drawPath(path,mPaint);
    

    You can look up the paint documentation but there are tons of options to control how its drawn.

    0 讨论(0)
提交回复
热议问题