Enu*_*uff 2 android picasso android-glide
我正在尝试使用 Glide 加载图像:
case "image":
Log.d("TRecyViewAdapter", "Got Image");
ImageView imageView = new ImageView(context);
imageView.setLayoutParams(new GridLayoutManager.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT
));
contents.addView(imageView);
Glide.with(context).load(part.getContent()).into(imageView);
break;
Run Code Online (Sandbox Code Playgroud)
它什么都不显示。
但是,如果我将最后一行更改为毕加索:
Picasso.with(context).load(part.getContent()).into(imageView);
Run Code Online (Sandbox Code Playgroud)
正如我所期望的那样,图像以全尺寸加载。
还。如果我使用带有占位符的 Glide:
Glide.with(context).load(part.getContent()).placeholder(R.mipmap.def_avatar).into(imageView);
Run Code Online (Sandbox Code Playgroud)
它加载图像但尺寸非常小(R.mipmap.def_avatar 的大小)
我希望能够加载实际大小的图像而不必指定占位符(它是一个动态视图,它应该显示许多不同大小的不同图像等等)
我想使用 Glide 而不是 Picasso 因为我想要支持动画 gif。
看起来添加覆盖可以解决问题。图像现在正在按预期加载。
Glide.with(context).load(part.getContent()).override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).into(imageView);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1463 次 |
| 最近记录: |