6

我通过像这样下载它来在图像视图中显示外部图像:

bitmap = BitmapFactory.decodeStream((InputStream)new URL(url).getContent());

然后将此位图设置为ImageView

imageView.setImageBitmap(bitmap);

除了其中一张图片是 PNG 并且我在使用BitmapFactory.

谁能告诉我如何保持透明背景?

4

1 回答 1

2

不确定这是否有帮助,但请尝试遵循此建议并添加选项以确保您的图像被拉入为 ARGB_8888

http://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeFile(java.lang.String , android.graphics.BitmapFactory.Options)

于 2012-02-22T00:55:02.640 回答