Android canvas draw rectangle

androidandroid-canvas

how to draw empty rectangle with etc. borderWidth=3 and borderColor=black and part within rectangle don't have content or color. Which function in Canvas to use

void drawRect(float left, float top, float right, float bottom, Paint paint)

void drawRect(RectF rect, Paint paint)

void drawRect(Rect r, Paint paint)

Thanks.

I try this example

Paint myPaint = new Paint();
myPaint.setColor(Color.rgb(0, 0, 0));
myPaint.setStrokeWidth(10);
c.drawRect(100, 100, 200, 200, myPaint);

It draws rectangle and fill it with black color but I want just "frame" around
like this image:

enter image description here

Best Answer

Try paint.setStyle(Paint.Style.STROKE)?