我使用a ListView来显示与这些图像相关的一些图像和标题.我从互联网上获取图像.有没有办法延迟加载图像,以便文本显示时,UI不会被锁定,图像会在下载时显示?
图像总数不固定.
我正在使用自定义适配器处理listview.我想加载图像和文本视图.图像是从互联网网址加载的.我只是想显示可见列表项的图像以供用户使用.我提到了来自romainguy的Shelves开源项目示例,但它很难理解代码.对于初学者级别,我只想知道如何处理适配器和活动之间的标记.从commonsware 示例我可以在适配器上设置标签,但不能在listview的空闲状态下显示相应的图像.请帮我解决你的想法.示例代码更容易理解.
谢谢.
编辑:
对高效适配器示例所做的更改如下:
public class List14 extends ListActivity implements ListView.OnScrollListener {
// private TextView mStatus;
private static boolean mBusy = false;
static ViewHolder holder;
public static class EfficientAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private Bitmap mIcon1;
private Bitmap mIcon2;
public EfficientAdapter(Context context) {
// Cache the LayoutInflate to avoid asking for a new one each time.
mInflater = LayoutInflater.from(context);
// Icons bound …Run Code Online (Sandbox Code Playgroud)