在我的应用中,位图的颜色看起来像是一些低质量的类型。如果我使用画廊应用程序加载背景图像,则正常加载,并且不会呈现出超低质量的外观。我用来加载和绘制图像的代码很简单:
//Code for initializing the Bitmap
Bitmap bitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.none), (int) (canvas.getWidth() * compression), (int) (canvas.getHeight() * compression), true);
//...
//Code for drawing this Bitmap
canvas.drawBitmap(bitmap, null, new RectF(0, 0, canvas.getWidth(), canvas.getHeight()), null);
如果代码中没有提示出错的信息,我制作了一张图片来比较在计算机或其他图像查看器上实际看起来像什么,以及在应用程序中看起来像什么。