question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Placehoder image not centered on Android P

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
frapeticommented, 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)

7reactions
oprisnikcommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

fixed placeholder in the center of image view - Stack Overflow
I want my image to fitXY and placeholder in the center but of smaller size, as you can see in above image ·...
Read more >
Image is not centered with .fitCenter() #1444 - bumptech/glide
The placeholder and the image probably have different aspects (#363). Try to use a placeholder that matches that squarish aspect.
Read more >
Lazy Loading Images – The Complete Guide - ImageKit.io
Lazy loading images that are not in the viewport improves initial page ... As the user scrolls down the page, the image placeholders...
Read more >
Displaying Images with the Picasso Library
Open up your static placeholder or error images in your drawable folders and make sure that the dimensions of the images are relatively...
Read more >
object-position - CSS: Cascading Style Sheets - MDN Web Docs
The object-position CSS property specifies the alignment of the selected replaced element's contents within the element's box.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found