I want to use the Glide Android library to download an image and show in ImageView
.
In the previous version we used:
Glide.with(mContext).load(imgUrl)
.thumbnail(0.5f)
.placeholder(R.drawable.PLACEHOLDER_IMAGE_NAME)
.error(R.drawable.ERROR_IMAGE_NAME)
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(imageView);
But I have seen Glide documentation:
it says use GlideApp.with()
instead Glide.with()
My concern is a missing placeholder, error, GlideApp, and other options.
I am using
compile 'com.github.bumptech.glide:glide:4.0.0'
Where am I doing wrong? With reference to here.
How has GlideApp.with()
been used?
The API is generated in the same package as the AppGlideModule
and is named GlideApp
by default. Applications can use the API by starting all loads with GlideApp.with()
instead of Glide.with()
:
GlideApp.with(fragment)
.load(myUrl)
.placeholder(placeholder)
.fitCenter()
.into(imageView);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…