Using Hardware Layer in Custom View onDraw
问题 So I'm trying to understand how I can properly use hardware acceleration (when available) in a custom View that is persistently animating. This is the basic premise of my onDraw() : canvas.drawColor(mBackgroundColor); for (Layer layer : mLayers) { canvas.save(); canvas.translate(layer.x, layer.y); //Draw that number of images in a grid, offset by -1 for (int i = -1; i < layer.xCount - 1; i++) { for (int j = -1; j < layer.yCount - 1; j++) { canvas.drawBitmap(layer.bitmap, layer.w * i, layer.h