Slo*_*ing 5
由于某些未知的原因,当您使用CustomTarget<Bitmap>
inside时会出现问题into()
。如果你只是这样使用它:
ImageView imageView = findViewById(R.id.image);
Glide.with(this)
.asBitmap()
.load("lomsnesvet.ca/wp-content/uploads/sites/21/2019/08/Kitten-Blog-1600x2400.jpg")
.centerCrop()
.into(imageView);
这有效,并将图像显示为centerCrop()
. 但是当你使用CustomTarget<Bitmap>
它时会忽略该方法。你可以做的是:
ImageView imageView = findViewById(R.id.image);
Glide.with(this)
.asBitmap()
.load("lomsnesvet.ca/wp-content/uploads/sites/21/2019/08/Kitten-Blog-1600x2400.jpg")
.centerCrop()
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
imageView.setImageBitmap(resource);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
然后你得到这个:
更多推荐
不适用于,Glide,centerCrop,CustomTarget
发布评论