Android的列表视图 - 只有当用户停止滚动的图像加载到项目 [英] Android Listview - only load images into items when user stops scrolling

查看:197
本文介绍了Android的列表视图 - 只有当用户停止滚动的图像加载到项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户滚动快速通过的项目,这似乎是多余的,开始要求图像来填充这些项目。毕竟,用户滚动这么快,他们将永远不会被下载/时间显示。有没有一种方法/事件触发第一次当用户实际上已经暂停滚动?

When the user scrolls quickly through items, it seems superfluous to start requesting images to populate those items. Afterall, the user is scrolling so fast, they will never be downloaded/shown in time. Is there any kind of method/event that first fires when the user has actually paused scrolling?

推荐答案

试试这个code,检测滚动站:

Try this code to detect scrolling stop :

setOnScrollListener(new OnScrollListener()
{
    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) 
    {
        // TODO Auto-generated method stub
    }
    public void onScrollStateChanged(AbsListView view, int scrollState) 
    {
        // TODO Auto-generated method stub
        if(scrollState == 0) 
            Log.i("a", "scrolling stopped...");
    }
});

这篇关于Android的列表视图 - 只有当用户停止滚动的图像加载到项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆