Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placehoder image not centered on Android P #2260

Closed
raymondctc opened this issue Dec 17, 2018 · 11 comments
Closed

Placehoder image not centered on Android P #2260

raymondctc opened this issue Dec 17, 2018 · 11 comments

Comments

@raymondctc
Copy link

raymondctc commented Dec 17, 2018

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
@wkingluoye
Copy link

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

@raymondctc
Copy link
Author

@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.

@stale
Copy link

stale bot commented Dec 25, 2018

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 stale bot added the stale label Dec 25, 2018
@thirtyyuan
Copy link

thirtyyuan commented Jan 1, 2019

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".

@stale stale bot removed the stale label Jan 1, 2019
@oprisnik
Copy link
Contributor

oprisnik commented Jan 8, 2019

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

@oprisnik oprisnik closed this as completed Jan 8, 2019
@thirtyyuan
Copy link

Did you verify on Google Pixel 2 XL?I just find this problem on Google Pixel 2 XL.

@frapeti
Copy link

frapeti commented Apr 29, 2019

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)

@TangoHanks
Copy link

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

@amankumarjain
Copy link

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

@alen252
Copy link

alen252 commented Aug 25, 2020

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.

@amazingvoice
Copy link

I just fixed the same issue on my Pixel 3 (Android 12) by creating a drawable-nodpi folder and moving the PNG to that folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants