How to fit Image into ImageView using Glide
Solution 1:
You can use centerCrop()
or fitCenter()
methods:
Glide.with(context)
.load(url)
.centerCrop()
.placeholder(R.drawable.default_image)
.into(img)
or
Glide.with(context)
.load(url)
.fitCenter()
.placeholder(R.drawable.default_image)
.into(img)
You can also find more information at: https://futurestud.io/tutorials/glide-image-resizing-scaling
Solution 2:
On Glide v4 you have to create a RequestOptions object, like this:
RequestOptions options = new RequestOptions();
options.centerCrop();
Glide.with(fragment)
.load(url)
.apply(options)
.into(imageView);
More info