fresco
fresco copied to clipboard
PlaceholderImageScaleType sometimes doesn't work
PlaceholderImageScaleType doesn't work
-
When I use the attribute of the roundedcorner, placeholderImageScaleType not normal work, like I set, on the system version for Android P's phone
-
Fresco version:com.facebook.fresco:fresco:2.1.0
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/draweePoiIcon"
android:layout_width="70dp"
android:layout_height="50dp"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:scaleType="fitCenter"
app:actualImageScaleType="fitCenter"
app:placeholderImage="@drawable/poi_detail_image_place_holder"
app:placeholderImageScaleType="fitCenter"
app:roundedCornerRadius="5dp" />
- The actual rendering shown:

-
The source file used:
-
I hope to get your help. Thank you very much
@oprisnik
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug" or "enhancement" and I will leave it open. Thank you for your contributions.
Please see https://github.com/facebook/fresco/issues/2260 and https://github.com/facebook/fresco/issues/2277
I use fresco 2.2.0. I'm still having this issue even after putting the png file to /res/drawable or /res/drawable-nodpi. But it's normal if the file is vector drawable.
Is your placeholder a normal PNG image?
It looks normal. And it worked fine when I used Glide.
What image format? A simple PNG?
Does it work if you set the placeholder image in code but don't specify the resource ID but the Drawable itself when the Drawable is loaded via Drawable placeholder = ContextCompat.getDrawable(context, R.drawable.name)
? See https://developer.android.com/reference/androidx/core/content/ContextCompat#getDrawable(android.content.Context,%20int)
I've solved this problem by moving the image resource into the drawable-nodpi file @lynn-kollectin @oprisnik
Thanks @oprisnik. If I set placeholder image programmatically, and I remove fresco:placeholderImage from xml, it works ok no matter using Drawable or resource ID. If I didn't remove fresco:placeholderImage from xml, it still displayed abnormally. (My those PNG files are in drawable-nodpi)
Yeah, I think the issue is that we do not use ContextCompat to load the Drawable but the system's version. We should change this. Pull requests are welcome :)
i have the same problem that the placeholderimagescaletype does not work. it came out from the 1.10.0 version. now i use the 1.9.0 version it works well. In the XML file it is fresco:placeholderImage ="@drawable/umeng_socialize_wechat",the drawble is a png file.
Hey, I would like to work on this.