ListView快速滑动时不加载图片

找了一些文章,感觉还是这种办法比较好
判断listview是在滑动状态,给adater发送这个状态,adapter可以判断加载不加载图片
可以在adapter写一个set方法,在activity调用方法传值。

public void onScrcllStateChanged(AbsListView view, int scrollState){
    if(scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE){
        // canDisplayImage = true;
        // adapter.notifyDataSetChanged();
    }else{
        // canDisplayImage = true;
        // adapter.notifyDataSetChanged();
    }
}
/** 在 adapter 中
 * if(canDisplayImage){
 *     // 加载图片
 * }
 * */

原文链接:http://www.jianshu.com/p/3b35109f8c04

猜你喜欢

转载自blog.csdn.net/sinat_35541927/article/details/52878455