public class CircleView extends View {
Paint paint,paint1,paint2,paint3;
public CircleView(Context context) {
super(context);
}
public CircleView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
paint = new Paint();
paint.setColor(Color.GREEN);
paint1 = new Paint();
paint1.setColor(Color.BLACK);
paint2 = new Paint();
paint2.setColor(Color.CYAN);
paint3 = new Paint();
paint3.setColor(Color.MAGENTA);
}
public CircleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public CircleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
RectF rectF = new RectF();
rectF.set(50,20,900,480);
// canvas.drawArc (rectF, 90, 45, true, paint);
// canvas.drawArc (rectF, 180, 90, true, paint1);
canvas.drawArc(rectF, 135, 180, false, paint);
canvas.drawArc(rectF, 135, 180 - 1, false,paint1);
canvas.drawArc(rectF, 90, 180+ 1, false,paint2);
canvas.drawArc(rectF, 90, 180, false, paint3);
canvas.drawArc(rectF, 45, 180, false, paint);
}
}
をいただければ幸いあなたは弧を描き、さまざまなペイントオブジェクトの助けを借りて、異なる色でそれを埋めることができ、私はいくつかのサンプルコードを掲示下の意味を成していること –