Search code examples
androidandroid-studiofresco

How can I get a SimpleDraweeView to display an image properly?


I have a SimpleDraweeView which is inside a Recycler.

Recycler:

<android.support.v7.widget.RecyclerView
    android:id="@+id/recycler_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

SimpleDraweeView:

<com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/feedImage"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            />

I tried a lot of ratio and scaleType but I can't seem to get the one that will display the full height(only 90% is displayed). The width is fine, but I can't seem to get the height properly. Which is the right combination to get a proper aspect ? (facebook like)


Solution

  • I didn't really understand what kind of scale type you are looking for, but it is definitely going to be configured by Fresco's lib with one of the following properties:

      fresco:actualImageScaleType="focusCrop|centerCrop|..."
      fresco:placeholderImageScaleType="fitCenter"
    

    Say you have some imageView of fixed height and 100% width:

      <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/feedImage"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            fresco:actualImageScaleType="centerInside" />