简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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