我有一个图库应用程序,可以在其中滑动加载视频缩略图。问题是我希望缩略图与原始图库中的缩略图相同。
fun bind(position: Int) {
selectedAlbum.mediaList[position].let {
Glide.with(itemView)
.load(it.path)
.apply(RequestOptions.centerCropTransform())
.into(itemView.mediaThumbnail)
}
}
上面的代码在我加载视频缩略图的适配器内部。该代码位于kotlin中,“ it”关键字指的是其中的媒体对象。path是视频的路径。
如何确保缩略图相同?
尝试使用毕加索。
Picasso.with(context)
.load(it.path) // thumbnail url goes here
.into(itemView.mediaThumbnail, new Callback() {
@Override
public void onSuccess() {
Picasso.with(context)
.load(it.path) // image url goes here
.placeholder(imageView.getDrawable())
.into(itemView.mediaThumbnail);
}
@Override
public void onError() {
}
});