我想在畫布上使用表面視圖繪製13個不同的位圖(顯然,使用表面視圖還有一些其他原因)。爲此,我開始了一個遊戲線程,我在其中調用了無限循環中的表面視圖方法,並且在此方法中,我在循環中繪製了13個不同的位圖。圖像(位圖)在繪製在表面視圖上的畫布上消失
但是在一些像三星銀河s3,銀河s2和摩托羅拉設備這樣的手機中,我的一些位圖在某些時間點後正在消失。
這裏是我的繪畫位圖代碼:
for (int i = 0; i < 13; i++) {
// Drawing Bushes
canvas.drawBitmap(assets.bushes[this.bushes[i].frameNo - 1], null,
camera.getScaledRect(bushes[i].bounds.getRect()),
bitmapPaint);
/*
* drawBitmap(canvas, bushes[i],
* assets.bushes[this.bushes[i].frameNo - 1], camera);
*/
// Drawing Waves
if (waves[i].alpha != 0) {
bitmapPaint.setAlpha((int) (waves[i].alpha * 255));
canvas.drawBitmap(assets.waves[this.waves[i].frameNo - 1],
null, camera.getScaledRect(waves[i].bounds.getRect()),
bitmapPaint);
bitmapPaint.setAlpha(255);
}
}