我正在尝试将一个文件作为位图加载到TouchImageview中。如果我使用普通的ImageView而不是TouchImageView,Glide库可以从文件对象中加载图像,但在TouchImageView中,Glide无法加载图像。
我也尝试了以下代码:
Glide.with(this).asBitmap().load(file).into(new SimpleTarget<Bitmap>(250, 250) {
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
touchImageView.setImageBitmap(resource);
}
@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {
super.onLoadFailed(errorDrawable);
}
});
但是调用
OnLoadFailed()
时,errorDrawable 为 null
。