Skip to content

Instantly share code, notes, and snippets.

@comoc
Created October 9, 2013 02:30
Show Gist options
  • Save comoc/6895224 to your computer and use it in GitHub Desktop.
Save comoc/6895224 to your computer and use it in GitHub Desktop.
Clear the Canvas of a SurfaceView for Android.
// Obtain a SurfaceView.
// SurfaceView surfaceView = (SurfaceView)findViewById(R.id.surfaceView1);
Canvas canvas = surfaceView.getHolder().lockCanvas();
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
// Draw someting
surfaceView.getHolder().unlockCanvasAndPost(canvas);
@dynoChris
Copy link

It's not work for me. Can you explain more pls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment