fresco icon indicating copy to clipboard operation
fresco copied to clipboard

PlaceholderImageScaleType sometimes doesn't work

Open QXH313 opened this issue 4 years ago • 12 comments

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

QXH313 avatar Mar 25 '20 04:03 QXH313

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.

stale[bot] avatar Apr 01 '20 06:04 stale[bot]

Please see https://github.com/facebook/fresco/issues/2260 and https://github.com/facebook/fresco/issues/2277

oprisnik avatar Apr 01 '20 10:04 oprisnik

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.

lynn-kollectin avatar May 22 '20 07:05 lynn-kollectin

Is your placeholder a normal PNG image?

oprisnik avatar May 27 '20 10:05 oprisnik

It looks normal. And it worked fine when I used Glide.

lynn-kollectin avatar May 27 '20 10:05 lynn-kollectin

What image format? A simple PNG?

oprisnik avatar May 27 '20 10:05 oprisnik

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)

oprisnik avatar May 27 '20 10:05 oprisnik

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

QXH313 avatar May 27 '20 11:05 QXH313

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)

lynn-kollectin avatar May 27 '20 11:05 lynn-kollectin

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 :)

oprisnik avatar May 27 '20 14:05 oprisnik

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.

liyadongcn avatar Jul 21 '20 07:07 liyadongcn

Hey, I would like to work on this.

Abhi-y2003 avatar Apr 19 '23 17:04 Abhi-y2003