如何的ImageView从URL加载图像列表项。加载图像从URL到的ListView
0
A
回答
3
只要您可以使用此library
它采用延迟加载的概念。
-1
试试下面的代码:
try
{
URL img_value = null;
img_value = new URL("ImageUrl");
Bitmap mIcon1 = BitmapFactory.decodeStream(img_value.openConnection().getInputStream());
Image.setImageBitmap(mIcon1);
}
catch(Exception e)
{
}
0
我的ListView适配器使用这getView()。
Webview kWebview = new Webview(context);
kWebview.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
kWebview.setFocusable(false);
kWebview.setClickable(false);
kWebview.setLongClickable(false);
kWebview.setFocusableInTouchMode(false);
kWebview.setInitialScale(100);
kWebview.setBackgroundColor(Color.BLACK);
WebSettings kSet = kWebview.getSettings();
kSet.setLoadWithOverviewMode(false);
kSet.setLoadsImagesAutomatically(true);
kSet.setAppCacheEnabled(true);
kSet.setAppCachePath(_context.getCacheDir().toString());
kSet.setCacheMode(WebSettings.LOAD_DEFAULT);
kSet.setAllowFileAccess(true);
kSet.setDomStorageEnabled(true);
kWebview.loadUrl("http://image_url");
Webview是更流畅加载超过ImageView的
0
试试这个代码:
string path = item.ImgPath;
URL url = new URL(path);
URI uri = new URI(url.Protocol, url.UserInfo, url.Host, url.Port, url.Path, url.Query, url.Ref);
url = uri.ToURL();
//convert it into bitmap
var bitmap = Android.Graphics.BitmapFactory.DecodeStream(url.OpenStream());
//set bitmap drawable
System.IO.Stream stream = url.OpenStream();
Img.SetImageBitmap(bitmap);
相关问题
- 1. Android从URL加载图像到ListView
- 2. 从URL加载图像到ListView
- 3. 从url加载图像到android listview
- 4. 将URL中的图片加载到ListView中的图像查看
- 5. ListView加载更多和url图像
- 6. 如何从listview中的文件json中的URL加载图像?
- 7. 从URL加载.svg图像
- 8. 图像不从URL加载
- 9. ImageSwitcher从url加载图像
- 10. Android从URL加载图像
- 11. 从url加载图像到picturebox背景
- 12. 图像未从URL加载到Mvx.MvxImageView
- 13. 加载图像url到editText
- 14. 从ListView的URL加载图像Xamarin Forms Visual Studio
- 15. ListView项目不加载从url的图像
- 16. 加载图像到StandardListItem的ListView BB10
- 17. 在将图像从SD加载到ListView时提高ListView效率
- 18. 使用分页将图像url加载到项目ListView中Android
- 19. 从ListView中加载图像android
- 20. Listview。从文件加载图像
- 21. 懒图像加载到ListView控件
- 22. 将图像加载到listview api中
- 23. 从Android中加载图像从URL
- 24. 将两个图像从url加载到图像查看
- 25. 如何将图像从url数组加载到图像数组?
- 26. C#WinForms - Listview加载图像
- 27. 从WatchKit上的URL加载图像
- 28. 加载图像从URL中的Android
- 29. 的UIImageView不从URL iphone加载图像
- 30. 从C++中的URL加载图像
你会得到NetworkOnUiThreadException – njzk2
@ njzk2:没有。它没有得到任何错误。和它的工作!好吧 –
不后,Android 2.3(或东西从你的代码失踪) – njzk2