question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strange issue in using placeholderImage in xml on SimpleDraweeView

See original GitHub issue

I am using this code in my xml:

   <com.facebook.drawee.view.SimpleDraweeView
    android:id="@+id/image"
    android:layout_width="96dp"
    android:layout_height="96dp"
    android:padding="16dp"
    fresco:placeholderImage="@drawable/_emergency_contact"
    fresco:roundAsCircle="true" />

Drawable _emergency_contact.png: http://i.imgur.com/8tzBJF6.png

Rendered image: http://i.imgur.com/yLrpWlQ.png

Some lines are coming on the sides of the image. Looks like some bug.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:4
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
balazsbalazscommented, Nov 25, 2015

I know this is strange but this is working as intended.

This is mentioned in the documentation at rounding: http://frescolib.org/docs/rounded-corners-and-circles.html

“Due to a limitation of Android’s BitmapShader, if the image doesn’t fully cover the view, instead of drawing nothing, edges are repeated. One workaround is to use a different scale type (e.g. centerCrop) that ensures that the whole view is covered.”

This is what “edges are repeated” means. If the view is bigger than the placeholder image the edges will repeat. We couldn’t find a better way to solve this (the other solution is to repeat the whole image) and we should publish a blog post about how rounding works. If anyone has a better idea we’re open to it 😃

There are two workarounds that you can do:

  1. Use OVERLAY_COLOR mode. This works perfectly if your background is a solid color. This doesn’t have any limitation and the performance is also good.
  2. If you can’t use OVERLAY_COLOR then add 1px invisible border to your image (that way the invisible border is the one that gets repeated).
0reactions
plamenkocommented, Dec 3, 2015

Or you can just add 1px transparent border to your image and then transparent pixels are going to be repeated (i.e. it will look correct). And I mean the image file (png) has to be saved with this transparent 1px border.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I have problems with circle image in Fresco - Stack Overflow
I have problem with round image, not works, Fresco download the image and display but not transform in a circle. I don't know...
Read more >
Placeholder, failure and retry images - Fresco
The placeholder image is displayed from before you've set a URI or a controller until it has finished loading (successfully or not). XML....
Read more >
android - SimpleDraweeView rounded inside scrollview - Stack ...
I'm trying to migrate from UIL to Facebook's Fresco lib. So far everything looks fine but when I put a rounded image inside...
Read more >
Loading images and caching them with Fresco in Android
There is no problem to load and show these data, the problem was in the ... Then a strange bug occured : the...
Read more >
Simpledraweeview Not Resizing After Scaling Image In Fresco
I like fresco but i have an issue with simpledraweeview which doesn't resize to ... android:layoutheight130dp fresco:placeholderImage@drawable/mydrawable.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found