0

I am using frescolib on my application to load images from url. However, I am experiencing a problem within the objects of the recyclerview. Specifically I need to center the images in SimpleDraweeView while keeping the format. So I'm using the following code, but I get the streaked, stretched images in the part that should be white.

this is wrong loaded image

this is original image

My code:

RoundingParams roundingParams = RoundingParams.fromCornersRadius(50f);
        GenericDraweeHierarchy hierarchy =
                GenericDraweeHierarchyBuilder.newInstance(activity.getResources())
                        .setRoundingParams(roundingParams)
                        .setActualImageScaleType(ScalingUtils.ScaleType.CENTER_INSIDE)
                        .setFailureImage(ContextCompat.getDrawable(activity,R.drawable.ic_image_off))
                        .setProgressBarImage(ContextCompat.getDrawable(activity,R.drawable.animview))
                        .build();
        this.imageView.setHierarchy(hierarchy);
        this.imageView.setImageURI(uri);

Any idea why the image is loaded badly?

ghost
  • 39
  • 1
  • 1
  • 3

1 Answers1

0

This is a Fresco limitation when the image does not cover the full viewport that will be fixed with the next Fresco release (2.7.0).

In the meantime, you can either change the scale type or use the overlay color rounding mode instead fi you have a solid background as a workaround for now (which should be possible looking at your screenshot):

RoundingParams roundingParams = RoundingParams.fromCornersRadius(50f);
roundingParams.setOverlayColor(yourBackgroundColorInt);
...

Fresco is using a BitmapShader which repeats the edge pixels that causes this issue. More information: https://frescolib.org/docs/rounded-corners-and-circles.html#caveats

Alexander Oprisnik
  • 1,212
  • 9
  • 9
  • Thank you for your reply and for the temporary solutions proposed by you. I hope the new version of the library will be released soon. – ghost Jan 20 '22 at 14:45