Fresco: Placehoder image not centered on Android P

Created on 17 Dec 2018  路  10Comments  路  Source: facebook/fresco

Description

The placeholder image is not centred on Android P (OK on other versions of Android):
screenshot_20181217-183117

Reproduction

When using the image below as placeholder image in SimpleDraweeView, placing it to drawable-xhdpi folder and with param roundAsCircle=true
edit_profile_default_avatar

Example XML

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/profile_avatar"
            android:layout_width="@dimen/profile_me_avatar"
            android:layout_height="@dimen/profile_me_avatar"
            android:layout_centerHorizontal="true"
            android:padding="@dimen/16dp"
            app:failureImage="@drawable/edit_profile_default_avatar"
            app:placeholderImage="@drawable/edit_profile_default_avatar"
            app:failureImageScaleType="fitCenter"
            app:actualImageScaleType="fitCenter"
            app:placeholderImageScaleType="fitCenter"
            app:roundAsCircle="true"
            />

Additional Information

  • Fresco version: 1.11.0
  • Platform version: Android Pie, Nokia 7 Plus

Most helpful comment

I'm still having this issue even after putting the file to /res/drawable

EDIT: Fixed it after moving the resource to /res/drawable-nodpi (tested on Pixel 2 XL - Android Q)

All 10 comments

I have the same problem as you. Do you have a solution?

@wkingluoye I found it can be solved by supplying all types of dimensions for this drawable, we used to have drawable-xhdpi only for this image in the past.

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 got the same problem, the version of fresco is 1.11.0, on Google Pixel 2 XL, but I didn't got the problem on Google Pixel 2. Maybe should let community know the issue. By the way, I also set roundAsCircle="true".

I verified that this works properly for P if you put the placeholder in res/drawable/. I guess Android P changed the way that drawables are loaded if variants are missing.

screenshot_1546955353

Did you verify on Google Pixel 2 XL锛烮 just find this problem on Google Pixel 2 XL.

I'm still having this issue even after putting the file to /res/drawable

EDIT: Fixed it after moving the resource to /res/drawable-nodpi (tested on Pixel 2 XL - Android Q)

I fixed this issue after putting image to drawable-nodpi folder (Test on Pixel 3 Android P)

i also had this same issue,
how i resolved it:
create a drawable-nodpi and mv a copy of those images to this folder, it will resolve this issue

I'm still having this issue even after putting the file to /res/drawable

EDIT: Fixed it after moving the resource to /res/drawable-nodpi (tested on Pixel 2 XL - Android Q)
But this will make probblem when the picture also used in low density phone.

Was this page helpful?
0 / 5 - 0 ratings