Fresco: Use fresco:actualImageScaleType="fitCenter" will

Created on 19 Aug 2015  路  1Comment  路  Source: facebook/fresco

I create a class extends SimpleDraweeView as SquareSimpleDraweeView and override this method:

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
}
use it in listview.
and use it in xml :
android:id="@+id/iv_pic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
fresco:actualImageScaleType="fitCenter"
fresco:placeholderImage="@drawable/icon_default_pic"
fresco:roundBottomLeft="true"
fresco:roundBottomRight="true"
fresco:roundTopLeft="true"
fresco:roundTopRight="true"
fresco:roundedCornerRadius="1px"
fresco:roundingBorderColor="@color/grey_cccccc"
fresco:roundingBorderWidth="1px"

display as :

image

It is a bug?

original picture is

image

Most helpful comment

No need to extend SimpleDraweeView to make it square, simply add the following XML properties: fresco:viewAspectRatio="1" and android:layout_height="wrap_content".
As for the repeated edges, this is a known limitation of Android. Please see the Caveats section of Rounded Corners and Circles.

>All comments

No need to extend SimpleDraweeView to make it square, simply add the following XML properties: fresco:viewAspectRatio="1" and android:layout_height="wrap_content".
As for the repeated edges, this is a known limitation of Android. Please see the Caveats section of Rounded Corners and Circles.

Was this page helpful?
0 / 5 - 0 ratings