Fresco 加载网络图片被裁剪

xiaoxiao2021-02-28  120

遇到一个Fresco 从网络加载图片,被放大并剪裁掉了而显示不全。百思不得解。 对比了本地图片的尺寸跟网络加载图片的尺寸一致,也不存在图片尺寸问题。

<com.facebook.drawee.view.SimpleDraweeView android:id="@+id/img_hot_up_rocket" android:layout_width="26dp" android:layout_height="38dp" android:layout_marginLeft="30dip" android:layout_marginTop="100dip" android:contentDescription="@string/app_name" fresco:placeholderImage="@drawable/live_hot_icon" />

解决: 查阅了fresco 官方文档后, fresco:actualImageScaleType=”fitCenter” 这个属性对SimpleDraweeView 被剪裁bug有效。可能是fresco:placeholderImage占位图的缘故吧。

fix code:

<com.facebook.drawee.view.SimpleDraweeView android:id="@+id/img_hot_up_rocket" android:layout_width="26dp" android:layout_height="38dp" android:layout_marginLeft="30dip" android:layout_marginTop="100dip" android:contentDescription="@string/app_name" fresco:actualImageScaleType="fitCenter" />

PS: 后来得知,有同事因为这个排查了一天。这个坑索性记一下~

转载请注明原文地址: https://www.6miu.com/read-38084.html

最新回复(0)