LoginSignup
1
2

More than 5 years have passed since last update.

Java Android drawCircleで描いた円の色を変える方法

Posted at

Java又はAndroidで,drawCircleで描いた円の色を変える方法

java.circle
// 描画用の準備
    paint = new Paint();
    paint2 = new Paint();
    paint.setColor(Color.GREEN);
    paint2.setColor(Color.CYAN);
  • Paintクラスのインスタンスを色を変えたい円の個数分用意して、カラーをセット

  • 上記の場合、paintとpaint2

  • んで、drawCircleの引数のpaint部分にそれぞれ入れるだけ。

java.circle
    canvas.drawColor(Color.BLACK);
    // GREENな円ができる  
    canvas.drawCircle(circleX, circleY, 60, paint);
    //CYAN(何色??)な円ができる
    canvas.drawCircle(20,30,60,paint2);

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2