机器人,使图像在URL等于ImageView的形象 [英] Android, Make an image at a URL equal to ImageView's image
本文介绍了机器人,使图像在URL等于ImageView的形象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道我怎么会作出这样位于一个特定的URL相当于一个的ImageView图像的图像?
I'm wondering how would I make an image that is located at a specific URL equal to an ImageView's image?
推荐答案
要下载的图像,并将其设置为内容的ImageView的
To download an image and set it as content for an imageview
try {
ImageView i = (ImageView)findViewById(R.id.image);
Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageUrl).getContent());
i.setImageBitmap(bitmap);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
这篇关于机器人,使图像在URL等于ImageView的形象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文