LuckyJayce / LargeImage

Android 加载大图 可以高清显示10000*10000像素的图片,轻松实现微博长图功能
Apache License 2.0
2.33k stars 416 forks source link

RecyclerView 中使用UpdateImageView时,设置了layoutparams,使用px时,导致图片加载不全。转成dp后,下方有空白 #28

Open dongdengke opened 7 years ago

dongdengke commented 7 years ago

RecyclerView 中使用UpdateImageView时,设置了layoutparams。使用px时,导致图片加载不全。转成dp后,下方有空白。图片越长,下方的空白越长。

LuckyJayce commented 7 years ago

代码贴出来看下

dongdengke commented 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) {

            }

        }

    });
}

`

LuckyJayce commented 7 years ago

为什么用这种方式 如果之前下载过难道要重新下么 每次滑动触发binditemview就下载么 快速滑动也要下载么 之前item被复用但是之前的下载回掉没被取消那么view显示之前的图片 随后又显示当前请求的图片怎么办

LuckyJayce commented 7 years ago

建议用glide或其他图片类库完成图片的缓存 然后取缓存的文件给largeimageview

monotonewang commented 6 years ago

不处理了吗?楼主

monotonewang commented 6 years ago

魅族手机又 openGL限制。。 其他手机应该也有