Glide
Glide is library which used to load fast images in Android.Glide can displays images , video and animations .
Dependency
1 2 |
implementation 'com.github.bumptech.glide:glide:4.11.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' |
How to use
You can load images in Glide simply by their url
1 2 3 |
GlideApp.with(context) .load("http://goo.gl/gEgYUd") .into(imageView); |
You can resize images size . Glide provide predefined method override
1 2 3 4 |
GlideApp.with(context) .load("http://goo.gl/gEgYUd") .override(300,300) .into(imageView); |
In Glide library you can attach placeholder or error images
1 2 3 4 5 |
GlideApp.with(context) .load("http://goo.gl/gEgYUd") .placeholder(R.drawable.placeholder) .error(R.drawable.ic_launcher_foreground) .into(imageView); |
You can crop image by using method centerCrop()
1 2 3 4 |
GlideApp.with(context) .load("http://goo.gl/gEgYUd") .centerCrop() .into(imageView); |
If you want to fit image size completely inside container you can use fitCenter
1 2 3 4 |
GlideApp.with(context) .load("http://goo.gl/gEgYUd") .fitCenter() .into(imageView); |
Glide can load images faster and easy way . It is very helpful .