画圆

这里写图片描述
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);
}

}
“`

猜你喜欢

转载自blog.csdn.net/qq_42859231/article/details/82285025