0

我的视图背景中有很多小图像。每个图像的位置取决于屏幕分辨率。还有其他对象在 onToch ivent 之后动态重绘。它在没有背景的情况下工作正常,但是当我尝试在 onDraw() 中绘制它时,我得到 KeyDispatchingTimedOut 错误。当我的应用程序首次启动时,如何在单个位图中构成背景,或者有其他更好的解决方案?

4

1 回答 1

1
Bitmap background = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(background);
canvas.draw(yourSmallImage, posX, posY, null);
....
c.drawBitmap(background, 0, 0, null);

这将使用“背景”作为暂存器,然后在完成“刮擦”后将完成的背景图像写入当前画布:-)

于 2011-05-24T11:04:35.893 回答