Android:カラーディスクの描き方:よりシンプル

本物のページはこちら→colordisk

Included page "colordisk" does not exist (create it now)

colordisk.png
private int[] mColors= new int[] { 
            0xFFFF0000,//red
            0xFFFFFF00,//yellow
            0xFF00FF00,//green
            0xFF00FFFF,//cyan
            0xFF0000FF,//blue
            0xFFFF00FF,//magenta
            0xFFFF0000,//red
        };
@Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawColor(Color.BLACK);
        Paint mCircle = new Paint();
        Shader shaderHue = new SweepGradient(CENTERX, CENTERY, mColors, null);
        mCircle.setStyle(Paint.Style.FILL);
        mCircle.setARGB(255, 255, 255, 100);
        mCircle.setShader(shaderHue);
        canvas.drawCircle(CENTERX,CENTERY, 100, mCircle);
        }

サポートサイト Wikidot.com