gpt4 book ai didi

android - 在 Glide-4 中找不到 GlideDrawableImageViewTarget

转载 作者:行者123 更新时间:2023-12-01 17:11:24 27 4
gpt4 key购买 nike

为什么在Glide4+中找不到GlideDrawableImageViewTarget?有什么替代方案吗?

我的代码:

import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;


Glide.with(getContext())
.load(R.drawable.loader_gif_image)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(new GlideDrawableImageViewTarget(imageView));
}

最佳答案

更新

Use below code if you are using glide:4.9.0

    Glide.with(this)
.load("")
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
.into(new DrawableImageViewTarget(imageView));


// or use this

Glide.with(this)
.load("")
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
.into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
imageView.setImageDrawable(resource);
}

@Override
public void onLoadCleared(@Nullable Drawable placeholder) {

}
});

试试这个

You can use new SimpleTarget<Drawable>()

    Glide.with(this)
.load(R.drawable.ic_favorite)
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
.into(new SimpleTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
imageView.setImageDrawable(resource);
}
});

试试这个

You can use new Target<Drawable>()

    Glide.with(this)
.load(R.drawable.ic_favorite)
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
.into(new Target<Drawable>() {
@Override
public void onLoadStarted(@Nullable Drawable placeholder) {

}

@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {

}

@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
imageView.setImageDrawable(resource);
}

@Override
public void onLoadCleared(@Nullable Drawable placeholder) {

}

@Override
public void getSize(@NonNull SizeReadyCallback cb) {

}

@Override
public void removeCallback(@NonNull SizeReadyCallback cb) {

}

@Override
public void setRequest(@Nullable Request request) {

}

@Nullable
@Override
public Request getRequest() {
return null;
}

@Override
public void onStart() {

}

@Override
public void onStop() {

}

@Override
public void onDestroy() {

}
});

关于android - 在 Glide-4 中找不到 GlideDrawableImageViewTarget,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61427558/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com