Fresco: no effect for set scaletype : centerCrop

Created on 22 Sep 2015  ·  3Comments  ·  Source: facebook/fresco

hello , I set the simpledraweeView scaletype as centerCrop , but it can't effect.

thank you for help!

my code:

xml:
android:id="@+id/iv_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:scaleType="centerCrop"
fresco:actualImageScaleType="centerCrop"
/>

java:
mImage = (SimpleDraweeView) itemView.findViewById(R.id.iv_image);
mImage.setAspectRatio(1.5f);

the result picture (the left pic is fail):
image

needs-details

Most helpful comment

simpleDraweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);

All 3 comments

Don't use android:scaleType.

However, it's not clear to me from your image what the problem is - the left image looks like it has indeed be center-cropped. Can you give us examples of what you are trying to see and what you are actually seeing?

I hope you are loading image from network. Do scaling programmatically holder.image.setScaleType(ImageView.ScaleType.CENTER_CROP);

simpleDraweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ykostova picture ykostova  ·  3Comments

zewenwang picture zewenwang  ·  4Comments

bigfreeZhou picture bigfreeZhou  ·  4Comments

satyarths picture satyarths  ·  3Comments

stephen-workpop picture stephen-workpop  ·  4Comments