去Listview找到当前可以看见的ItemView, 以及对应的要刷新的View, 例如Progressbar 刷新之
ListepiDownloadBeans = mDownloadAdapter.getList(); int firstVisiblePosition = dl_listview.getFirstVisiblePosition(); int lastVisiblePosition = dl_listview.getLastVisiblePosition(); for (int i = firstVisiblePosition; i < lastVisiblePosition; i++) { View itemView = dl_listview.getChildAt(i-firstVisiblePosition); if (itemView == null) { LogUtil.d(TAG, "itemView == null"); continue; } ProgressBar progressBar = (ProgressBar) itemView.findViewById(R.id.dl_item_progress); if (i < 0 || i >= epiDownloadBeans.size()) { LogUtil.e(TAG, "surprise index when get epiDownloadBean i = " + i); continue; } EpiDownloadBean epiDownloadBean = epiDownloadBeans.get(i); if (progressBar != null) { try { epiDownloadBean.setPrecent((int) (TaskManager.getInstance().getDownloadTask(epiDownloadBean.getTask_id(), epiDownloadBean.getUrl(), epiDownloadBean.getSavePath()).getPercent() * 100)); progressBar.setProgress(epiDownloadBean.getPrecent()); } catch (Exception e) { e.printStackTrace(); } } }
参考
http://www.cnblogs.com/liuling/p/2015-10-20-01.html
http://www.jianshu.com/p/45a43a117365