欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

画圆

程序员文章站 2022-03-10 12:13:30
...

画圆
package com.example.dell.day01_0830;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

/**
* Created by Dell on 2018/9/1.
*/

public class Custom extends View{
public Custom(Context context) {
super(context);
}

public Custom(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
}

public Custom(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
}

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    Paint paint = new Paint();
    paint.setColor(Color.RED);
    paint.setStyle(Paint.Style.FILL_AND_STROKE);
    canvas.drawCircle(100,100,100,paint);
}

}
“`