glide rounded corner transform issue
Solution 1:
I had the same issue, the problem in my case was the image what i've tried to load had less size in pixels (320x480), then the ImageView size in pixels. My solution was the following:
My ImageView in the xml file:
<ImageView
android:id="@+id/image_program_thumb"
android:layout_width="match_parent"
android:layout_height="186dp" />
ProgramViewHolder.java class
@BindView(R.id.image_program_thumb) ImageView mProgramThumbnail;
.....
void bindData(final Program item) {
RequestOptions requestOptions = new RequestOptions();
requestOptions = requestOptions.transforms(new CenterCrop(), new RoundedCorners(16));
Glide.with(itemView.getContext())
.load(item.getImage())
.apply(requestOptions)
.into(mProgramThumbnail);
....
}
P.S. I use 4.2.0 version of Glide
Solution 2:
in Glide V4
Try like this
Glide.with(this.context)
.load(url)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(14)))
.into(ImageView);
Solution 3:
For Glide v4.9 transformation (java):
Glide.with(this)
.load(R.drawable.sample)
.transform(new CenterCrop(),new RoundedCorners(25))
.into(image);