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

Created on 1 Apr 2019  ·  5Comments  ·  Source: facebook/fresco

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]
docs question

All 5 comments

@oprisnik- is this the expected behavior?

I want to set the FailureImage and want the ScaleType to be centered, but once I set the rounded roundedCornerRadius. Can't be centered

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.

unsolved

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

Was this page helpful?
0 / 5 - 0 ratings