简体   繁体   English

Android Listview-仅在用户停止滚动时才将图像加载到项目中

[英]Android Listview - only load images into items when user stops scrolling

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? 当用户实际暂停滚动时,是否有任何一种方法/事件会首先触发?

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...");
    }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM