Fresco中在listview之类的快速滑动时停止加载,滑动停止后恢复加载:
1.设置图片请求是否开启[java]view plaincopy print? //暂停图片请求publicstaticvoidimagePause(){Fresco.getImagePipeline().pause();}//恢复图片请求publicstaticvoidimageResume(){Fresco.getImagePipeline().resume();}
2.设置ListView滚动监听[java]view plaincopy print? <prename="code"class="java"><prename="code"class="java">mListView.setOnScrollListener(newAbsListView.OnScrollListener(){@OverridepublicvoidonScrollStateChanged(AbsListViewview,intscrollState){switch(scrollState){caseAbsListView.OnScrollListener.SCROLL_STATE_IDLE://空闲状态imageResume();break;caseAbsListView.OnScrollListener.SCROLL_STATE_FLING://滚动状态imagePause();break;caseAbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL://触摸后滚动break;}}publicvoidonScroll(AbsListViewview,intfirstVisibleItem,intvisibleItemCount,inttotalItemCount){}});
就是这么多,赶紧试试吧!