Open dongdengke opened 7 years ago
代码贴出来看下
` //1.下载 private void downLoadByOkHttp(final MYViewHolder holder, String url, String name, final String type, final String picHeight, final String picWidth) { DownLoadUtils.downLoadFile(url, name, new DownLoadUtils.ReqProgressCallBack() { @Override public void onProgress(long total, long current) { Log.d("onProgress", total + " -- " + current); //total = 8159500; int thisPer = (int) (360 * current / total); if (preProgress < thisPer) { Log.d("onProgress", thisPer + ""); } preProgress = thisPer; holder.pw_spinner.setProgress(preProgress); }
@Override
public void failed() {
Log.d("failed", "failed");
}
@Override
public void success(File file) {
Log.d("success", file.getPath());
holder.pw_spinner.setVisibility(View.GONE);
try {
if (type.equals("gif")) {
startGif(holder, file.getAbsolutePath());
} else if (type.equals("pic")) {
int heighDp = WindowUtils.dip2px(context, Integer.parseInt(picHeight));
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)
holder.iv_bigpic.getLayoutParams();
lp.height = (int) heighDp;
holder.iv_bigpic.setLayoutParams(lp);
holder.iv_bigpic.setImage(new FileBitmapDecoderFactory(file));
}
} catch (Exception e) {
}
}
});
}
`
为什么用这种方式 如果之前下载过难道要重新下么 每次滑动触发binditemview就下载么 快速滑动也要下载么 之前item被复用但是之前的下载回掉没被取消那么view显示之前的图片 随后又显示当前请求的图片怎么办
建议用glide或其他图片类库完成图片的缓存 然后取缓存的文件给largeimageview
不处理了吗?楼主
魅族手机又 openGL限制。。 其他手机应该也有
RecyclerView 中使用UpdateImageView时,设置了layoutparams。使用px时,导致图片加载不全。转成dp后,下方有空白。图片越长,下方的空白越长。