安卓。从网络上下载图片并在网格视图上显示它们[英] Android: Download images from web and show them on gridview

本文是小编为大家收集整理的关于安卓。从网络上下载图片并在网格视图上显示它们的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我想创建一个从网页中获取一些图像的程序,并在GridView上显示它们.我不知道有多少人.它可能是20到30.但是我不知道这次使用哪种方式.

目前,我想获得的是一个progressbar(圆圈单击),而图像正在下载.一旦下载,它将消失,图像将加载.我将使用带有适配器的一系列对象来填充GridView.

您将使用哪种方式使用asynctask?

预先感谢.

推荐答案

我建议您检查哈佛扩展CS76的第6章.有一个URLImageAdapter和示例源代码,可以做示例您要寻找的内容.

最佳幸运

其他推荐答案

如果要保存下载的图像并将其重复使用,则必须查看 downloadmanager

要使用骑自行车圈显示对话框,请查看以下内容: howdialog how to progressDialog

本文地址:https://www.itbaoku.cn/post/102407.html

问题描述

I want to create a program that gets some images from a webpage, and shows them on a gridview. I dont know how many of them exactly. It could be from 20 to 30. Ill do it with asynctask, which i have allready used before and more or less know how it works. But i don't know which way use it this time.

For now, what i would like to get is a progressbar (circle clicking) while image is downloading. And once its downloaded, it would disappear and image will load. I will use an array of objects with an adapter, to fill the gridview.

Which way would you use the asynctask?

Thanks in advance.

推荐答案

I would suggest you check out Lecture 6 of Harvard Extension CS76. There is a URLImageAdapter and example source code that does example what you are looking for.

Best of luck

其他推荐答案

If you want to save downloaded images and reuse them in future then you must look DownloadManager

To display dialog with cycling circle, look this: howto use ProgressDialog