Glide 在加载图像后不会将 GlideDrawable 设置为 ImageView
Glide doesn't set GlideDrawable into ImageView after loading image
我正在 Fragment
中使用 Glide 以这种方式加载图像
Glide.with(this).load(pictureUrl)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.default)
.into(image);
但是图像从未设置到 ImageView
中,尽管图像确实正在加载(我使用侦听器对此进行了调查)。我相信这只会在图像未从内存加载时发生,因为如果 Fragment
恢复,它会加载。
如果我在上面添加 asBitmap()
,则图像会成功加载。此外,通过附加的 RequestListener
的 onResourceReady()
方法将 GlideDrawable
设置为 ImageView
也有效。
对于其他有类似问题的人,结果证明它与自定义视图有关。有关详细信息,请参阅 the post on the discussion list。
我正在 Fragment
Glide.with(this).load(pictureUrl)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.default)
.into(image);
但是图像从未设置到 ImageView
中,尽管图像确实正在加载(我使用侦听器对此进行了调查)。我相信这只会在图像未从内存加载时发生,因为如果 Fragment
恢复,它会加载。
如果我在上面添加 asBitmap()
,则图像会成功加载。此外,通过附加的 RequestListener
的 onResourceReady()
方法将 GlideDrawable
设置为 ImageView
也有效。
对于其他有类似问题的人,结果证明它与自定义视图有关。有关详细信息,请参阅 the post on the discussion list。