Canvas does not draw in Custom View

前端 未结 2 918
耶瑟儿~
耶瑟儿~ 2021-01-11 12:04

I created a Custom View CircleView like this:

public class CircleView extends LinearLayout {

    Paint paint1;
    public CircleView(Context context) {
             


        
2条回答
  •  时光说笑
    2021-01-11 12:29

    Where is your this.draw() method?

    This should work definitively:

    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);         
        canvas.drawCircle(50, 50, 25, paint1);
        //this.draw(canvas);  where is this method?
    }
    

提交回复
热议问题