SurfaceView를 구현했습니다. 그런 다음 자신 만의 비트 맵과 캔버스를 만들어 화면에 그려서 비트 맵을 화면에 그립니다. 예를 들어
:
private Canvas myCanvas = null;
private Bitmap myCanvasBitmap = null;
private Matrix identityMatrix;
public mySurfaceCreated(canvasWidth, canvasHeight){
myCanvasBitmap = Bitmap.createBitmap(canvasWidth, canvasHeight, Bitmap.Config.ARGB_8888);
myCanvas = new Canvas();
myCanvas.setBitmap(myCanvasBitmap);
identityMatrix = new Matrix();
}
public void myDraw(Canvas canvas) {
// Draw stuff onto myCanvas, NOT the canvas given by the android OS.
drawStuff(myCanvas);
// Draw onto the canvas given by the android OS.
canvas.drawBitmap(myCanvasBitmap, identityMatrix, null);
}
나는 캔버스 전체 매번 그릴 필요가 없습니다이 방법 대신에만 필요한 변경. OS에서 생성 된 캔버스는 매번 완전히 그려집니다.
잘 모르겠지만 배경 drawable을 null로 설정하면 배경이 지워지지 않을 수 있습니다. 또한 시도 할 또 다른 것은 super.onDraw()를 호출하지 않는 것입니다. –