androidsurfaceview清屏
引用:http://www.eoeandroid.com/forum.php?mod=viewthread&tid=40776 12樓
清屏可以用橡皮擦的畫筆畫一個螢幕大小的矩形就可以了
//這是定義橡皮擦畫筆
Paint clearPaint = new Paint();
clearPaint.setAntiAlias(true);
clearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
//清屏過程
mDrawingView.mCanvas.drawRect(0, 0, 800, 480, clearPaint);
Canvas canvas = mDrawingView.mSurfaceHolder.lockCanvas();
canvas.drawColor(Color.TRANSPARENT,Mode.CLEAR);
canvas.drawBitmap(mDrawingView.mBitmap, 0, 0, mDrawingView.mBitmapPaint);
mDrawingView.mSurfaceHolder.unlockCanvasAndPost(canvas);
(mDrawingView是我的SurfaceView)