Canvasに円を描く | とある文系SEの開発日記

とある文系SEの開発日記

文系学部から某SIerに就職が決まったぺーぺーエンジニアのブログ

Canvasに円を描く方法


【x:100、y:100、半径=10の円を描く】




@Override
protected void onDraw(Canvas canvas) {

  //円のX座標
private float x = 100.0f;
//円のY座標
private float y = 100.0f;
//円の半径
  private float r = 10.0f;

//色等を決めるPaintインスタンス
Paint paint = new Paint();
paint.setColor(Color.argb(255, 255, 255, 255));
  //アンチエイリアスの有無
paint.setAntiAlias(true);

canvas.drawCircle(x, y, r, paint);
}