需求大概是
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);
}
}