Fresco: PlaceholderImageScaleType sometimes doesn't work

Created on 25 Mar 2020  ·  11Comments  ·  Source: facebook/fresco

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:

rendering

  • The source file used:
    original_image

  • I hope to get your help. Thank you very much

@oprisnik

enhancement good first issue help wanted

Most helpful comment

I've solved this problem by moving the image resource into the drawable-nodpi file
@lynn-kollectin @oprisnik

All 11 comments

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stephen-workpop picture stephen-workpop  ·  4Comments

amodkanthe picture amodkanthe  ·  3Comments

satyarths picture satyarths  ·  3Comments

sungerk picture sungerk  ·  3Comments

cococool picture cococool  ·  4Comments