Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android中的ListView滚动延迟_Android_Image_Listview_Scroll_Lag - Fatal编程技术网

android中的ListView滚动延迟

android中的ListView滚动延迟,android,image,listview,scroll,lag,Android,Image,Listview,Scroll,Lag,我的应用程序中有一个自定义列表视图,它显示图像和文本。 我从URL获取的图像,使用以下代码: private static Drawable ImageOperations(Context ctx, String url, String saveFilename) { try { InputStream is = (InputStream) fetch(url); Drawable d = Drawable.createFromStream

我的应用程序中有一个自定义列表视图,它显示图像和文本。 我从URL获取的图像,使用以下代码:

private static Drawable ImageOperations(Context ctx, String url,
        String saveFilename) {
    try {
        InputStream is = (InputStream) fetch(url);
        Drawable d = Drawable.createFromStream(is, "src");
        return d;
    } catch (MalformedURLException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}

public static Object fetch(String address) throws MalformedURLException,
IOException {
    URL url = new URL(address);
    Object content = url.getContent();
    return content;
}
所有的工作都很完美,除了列表视图滚动,它非常慢。如果禁用图像,滚动速度会变慢,但启用图像后,滚动速度会滞后很多

是否有任何可能的方法可以减少或消除这种滞后现象


谢谢

您需要在后台进行抓取。 您可以使用以下示例之一:
您需要在后台进行抓取。 您可以使用以下示例之一:
您是否懒得加载图像

您是否懒得加载图像

使用此库在后台下载图像并缓存。。 它不会伤害用户界面

使用此库在后台下载图像并进行缓存。。 它不会伤害用户界面