需求大概是
User这边用一个个的指令
去画出Surfaceview上面的图&文字
当然前面的指令画出来的后面不能够消失
因为跟时间没啥关系,所以我是想不要用Thread来做
我自己测试成功的测试小程式
主要的function是:
Canvas canvas;
public void draw()
{
synchronized (myholder) {
canvas = myholder.lockCanvas(new Rect(0, 0,
sizeMetrics.widthPixels,
sizeMetrics.heightPixels));
canvas.drawCircle(x, y, 30, paint);
myholder.unlockCanvasAndPost(canvas);
myholder.lockCanvas(new Rect(0, 0, 0, 0));
myholder.unlockCanvasAndPost(canvas);
myholder.lockCanvas(new Rect(0, 0, 0, 0));
myholder.unlockCanvasAndPost(canvas);
}
}