Fresco: When using roundAsCircle , placeholder image is no longer displaying as expected

Created on 21 Jan 2019  路  9Comments  路  Source: facebook/fresco

Description

When setting fresco:roundAsCircle="true", fresco:placeholderImageScaleType="centerCrop" is ignored. I should see the placeholder image with it's X and Y filling the space. However, it instead displays a small version in the upper left corner.

Reproduction

Set fresco:placeholderImage="whatever image"
Set fresco:placeholderImageScaleType="centerCrop"
Set fresco:roundAsCircle="true"

Additional Information

  • Fresco version: 1.11.0
  • Platform version: Android 9 Google Pixel 3 XL
enhancement needs-details

Most helpful comment

confirmed that when placing the PNG in a non density specific folder like drawable or drawable-nodpi the problem is resolved. thank you for the help.

All 9 comments

Hi @nbortolussi

The option to round the image has some limitations for images which are smaller than the view it's being drawn in, see the documentation: https://frescolib.org/docs/rounded-corners-and-circles.html
Do you still experience the same issue if the placeholder image is larger?

Hi @erikandre unfortunately I am experiencing the same results even with the placeholder image much larger than the view. Am I missing something?

OK, that's unexpected. Could you attach a screenshot of how this looks?

The image width and height are bigger than view width and height. Camera icon is directly in the center.

<com.facebook.drawee.view.SimpleDraweeView android:id="@+id/add_image_button" android:layout_width="150dp" fresco:placeholderImage="@drawable/bg_camera" android:layout_height="150dp" fresco:actualImageScaleType="centerCrop" fresco:roundAsCircle="true" fresco:placeholderImageScaleType="centerCrop" android:layout_centerInParent="true"/>

ss

bg_camera

Is the placeholder a PNG file?

This is likely a duplicate of #2260. Looks like Android changed the way that resources are handled if a density bucket is missing. Do you supply all densities or put the resource in /drawable/ instead of drawable-xhdpi or similar?

correct I only have one version of the PNG. it resides in /drawable-xhdpi/. for most icons I am supplying all densities, but am not for some such as this that are being used as placeholders or background images etc. in fresco views. will try placing it in /drawable

confirmed that when placing the PNG in a non density specific folder like drawable or drawable-nodpi the problem is resolved. thank you for the help.

confirmed that when placing the PNG in a non density specific folder like drawable or drawable-nodpi the problem is resolved. thank you for the help.

I can only put one png in drawable-nodpi.But how to select the png size that display normal in different screen density mobile phone.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bigfreeZhou picture bigfreeZhou  路  4Comments

kingty picture kingty  路  4Comments

sungerk picture sungerk  路  3Comments

stevenmtang picture stevenmtang  路  3Comments

eresid picture eresid  路  4Comments