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.

After using the roundedCornerRadius property, setFailureImage ScaleType does not work properly

See original GitHub issue

Description

After using the roundedCornerRadius property, setFailureImage ScaleType does not work properly

Reproduction

  • xml
<com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/pic_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        fresco:viewAspectRatio="1.77"
        fresco:roundedCornerRadius="@dimen/spa_3"/>
  • code
/**
     * 设置通用样式
     *
     * @param view          SimpleDraweeView
     * @param load_drawable 加载动画
     * @param place_holder  默认图
     */
    private static void initImageHierarchy(SimpleDraweeView view, Drawable load_drawable, int place_holder) {
        GenericDraweeHierarchy hierarchy = view.getHierarchy();
        hierarchy.setFadeDuration(500);
        hierarchy.setProgressBarImage(load_drawable);
        hierarchy.setFailureImage(R.mipmap.place_holder, ScalingUtils.ScaleType.CENTER_INSIDE);
        if (place_holder != 0) {
            hierarchy.setPlaceholderImage(place_holder, ScalingUtils.ScaleType.CENTER_INSIDE);
        }
        hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_XY);
    }

Solution

  • fresco:roundedCornerRadius=“@dimen/spa_3” After use, there will be no centering setFailureImage
  • ScalingUtils.ScaleType.CENTER_INSIDE It seems to lose the benchmark

Additional Information

  • Fresco version: [1.13.0]
  • Platform version: [Android 9]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
oprisnikcommented, Apr 9, 2019

Please set a failure image scale type. That should fix your issues.

0reactions
yaooortcommented, Apr 9, 2019

unsolved

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImageView ScaleType is Not Working - why? - Stack Overflow
ImageViews showing pictures off course but every image has different aspect ratio. Then i want to use ImageView scaleType property for image's ...
Read more >
Using SimpleDraweeView - Fresco
When using Fresco, you will use SimpleDraweeView to display images. These can be used in XML layouts. The simplest usage example of SimpleDraweeView...
Read more >
ImageView.ScaleType - Android Developers
Scale using the image matrix when drawing. The image matrix can be set using ImageView#setImageMatrix(Matrix) . From XML, use this syntax: ...
Read more >
Android Fresco图片处理库用法API英文原文文档2-1 ...
This is a property of the controller, not the hierarchy. It therefore is not set by any of the methods used by the...
Read more >
Working with the ImageView | CodePath Android Cliffnotes
In the example, using scaleType "center", the image will be displayed at its ... the image and still adjust the image according to...
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