本文介绍了Android的画布上绘制矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何绘制等边框宽度= 3,并在矩形边框颜色=黑色和部分没有内容或颜色空矩形。其作用画布使用
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)
感谢。
我尝试这个例子
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" aroundlike this image:
推荐答案
尝试 paint.setStyle(Paint.Style.STROKE)
?
这篇关于Android的画布上绘制矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!