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 m
Here's the working code for your requirement....
Editing the 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....