Fresco 加载网络图片被裁剪

来源:互联网 发布:英国硕士绩点算法 编辑:程序博客网 时间:2024/06/10 14:44

遇到一个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: 后来得知,有同事因为这个排查了一天。这个坑索性记一下~

原创粉丝点击