画板:绘制画面

创建一个类,这个类继承View类

在onDraw()方法中绘制

public class MyGridView extends 

View{
    public MyGridView(Context 

context){
            super(context);
            // TODO Auto-generated 

constructor stub
        }
        @Override
        protected void onDraw

(Canvas canvas){
             // TODO Auto-generated 

method stub
             super.onDraw(canvas);
             Paint shapePaint = new 

Paint();
            //设置宽度
            

shapePaint.setStrokeWidth(2);

            canvas.drawPoint

(20,20,shapePaint);
            canvas.drawLine

(20,30,20,70,shapePaint);
            canvas.drawRect

(20,80,140,shapePaint);

            //画空心矩形
            shapePaint.setStyle

(Paint.Style.STROKE);
            canvas.drawRect

(20,150,80,200,shapePaint);

             Rect path = new Path

();
             shapePaint.setColor

(Color.GREEN);
             path.addCircle

(150,200,50,Direction.CW);

            
             canvas.drawPath

(path,shapePaint);                  

  shapePaint.setTextSize(18);
             

shapePaint.setFakeBoldText(true);
             canvas.drawTextOnPath

("Welcome to my home!",path, 0, 

10,shapePaint);
        }
}