我需要将 URL 中的图像设置到 imageView 中。我找到了一些解决方案,但没有一个对我有用。
有人可以帮我吗?
最佳答案
首先你需要声明这个变量:
Bitmap bmp;
然后添加以下代码:
String imageUrl = "URL";
InputStream in = new URL(imageUrl).openStream();
bmp = BitmapFactory.decodeStream(in);
ImageView img_results_experience = (ImageView)view.findViewById(R.id.img_results_experience);
img_id.setImageBitmap(bmp);
这对我有用!!
关于java - 如何从 URL 设置 imageView 图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42838608/