【问题标题】:displaying image in the imageview directly from the internet直接从 Internet 在 imageview 中显示图像
【发布时间】:2014-02-25 09:14:35
【问题描述】:

我想将位于urlhttp://www.Karnatakatourism.org/mm/slide/chickmaglur_home.jpg”的图像加载到Android 中的imageview

谁能帮我写代码来做同样的事情?

【问题讨论】:

标签: android android-imageview


【解决方案1】:
You can use android query lib.
check it out
http://code.google.com/p/android-query/wiki/ImageLoading

you just need to write
aq.id(R.id.imageview_profilee).image("your path");

【讨论】:

  • 即使你不需要在 AsyncTask 中编写这段代码
【解决方案2】:

你可以用这个...

有很多库可以做到这一点,你可以使用Picasso

这里是一个用法示例:

Picasso.with(context).load("http://www.karnatakatourism.org/mm/slide/chickmaglur_home.jpg").into(imageView);

或者你可以使用Universal Image Loader class

你可以在其中使用这个。

 imageLoader.displayImage("http://www.karnatakatourism.org/mm/slide/chickmaglur_home.jpg", imageView, options);

【讨论】:

  • 是的,你必须这样做。你也可以使用 AsyncTask。
猜你喜欢
  • 1970-01-01
  • 2016-02-28
  • 1970-01-01
  • 2016-11-16
  • 2015-03-20
  • 2015-11-09
  • 1970-01-01
  • 2018-11-07
  • 1970-01-01
相关资源
最近更新 更多