由网友(▼閞始敩習倣棄)分享简介:我要画这种类型的圈子我的应用程序。我能够得出使用画布圈,但我不能获得有关如何使分区的任何想法?I want to draw this type of circle in my application. I am able to draw circle using Canvas but I can't get any...
我要画这种类型的圈子我的应用程序。我能够得出使用画布圈,但我不能获得有关如何使分区的任何想法?
I want to draw this type of circle in my application. I am able to draw circle using Canvas but I can't get any idea about how to make partitioned?
任何人都可以建议我怎么才能让分区圈子?
Can anyone suggest me how can I make partitioned of circle?
编辑: - 我想提请行是内圆
在此先感谢。
推荐答案
这里的工作$ C $下您的要求......
Here's the working code for your requirement....
编辑code: -
Paint paint1 = new Paint();
Paint paint2 = new Paint();
Paint paint3 = new Paint();
Paint paint4 = new Paint();
Paint paint5 = new Paint();
final RectF rect = new RectF();
int mRadius = 130;
//Example values
rect.set(getWidth()/2- mRadius, getHeight()/2 - mRadius, getWidth()/2 + mRadius, getHeight()/2 + mRadius);
paint1.setColor(Color.GREEN);
paint1.setStrokeWidth(mRadius/2);
paint1.setAntiAlias(true);
paint1.setStrokeCap(Paint.Cap.BUTT);
paint1.setStyle(Paint.Style.STROKE);
paint2.setColor(Color.RED);
paint2.setStrokeWidth(mRadius/2);
paint2.setAntiAlias(true);
paint2.setStrokeCap(Paint.Cap.BUTT);
paint2.setStyle(Paint.Style.STROKE);
paint3.setColor(Color.BLUE);
paint3.setStrokeWidth(5);
paint3.setAntiAlias(true);
paint3.setStrokeCap(Paint.Cap.BUTT);
paint3.setStyle(Paint.Style.STROKE);
canvas.drawArc(rect, 0, 60, false, paint1);
canvas.drawArc(rect, 60, 60, false, paint2);
canvas.drawArc(rect, 120, 60, false, paint1);
canvas.drawArc(rect, 180, 60, false, paint2);
canvas.drawArc(rect, 240, 60, false, paint1);
canvas.drawArc(rect, 300, 60, false, paint2);
canvas.drawLine(getWidth()/2,
getHeight()/2, getWidth()/2-mRadius/2, getHeight()/2-mRadius/2,paint3);
canvas.drawLine(getWidth()/2,
getHeight()/2, getWidth()/2+mRadius/2, getHeight()/2-mRadius/2,paint3);
canvas.drawLine(getWidth()/2,
getHeight()/2, getWidth()/2-mRadius/2, getHeight()/2+mRadius/2,paint3);
canvas.drawLine(getWidth()/2,
getHeight()/2, getWidth()/2+mRadius/2, getHeight()/2+mRadius/2,paint3);
canvas.drawLine(getWidth()/2,
getHeight()/2, getWidth()/2-mRadius/4-mRadius/2, getHeight()/2,paint3);
canvas.drawLine(getWidth()/2,
getHeight()/2, getWidth()/2+mRadius/4+mRadius/2, getHeight()/2,paint3);
paint4.setColor(Color.BLACK);
canvas.drawCircle(getWidth()/2, getHeight()/2, mRadius/2, paint4);
paint5.setColor(Color.YELLOW);
paint5.setStrokeWidth(3);
paint5.setAntiAlias(true);
paint5.setStrokeCap(Paint.Cap.BUTT);
paint5.setStyle(Paint.Style.STROKE);
canvas.drawCircle(getWidth()/2, getHeight()/2, mRadius/2, paint5);
我现在希望你满意我的回答......
I hope now you satisfy with my answer....
相关推荐
最新文章