我需要通过指定文件名而不是使用资源来显示图像。例如 showImage("background.png")
而不是 showImage(R.drawable.background)
。
有人知道吗?
非常感谢。
最佳答案
阅读此 Android Image Tutorial .有一个使用 FileOutputStream 写入图像的示例,我相信也有 FileInputStream。这是 another code example下载图像并将它们转换为已解码的输入流:
bmImg = BitmapFactory.decodeStream(is);
imView.setImageBitmap(bmImg);
关于android - 按文件名显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/587454/