0

我有一个SimpleDraweeView在回收站内。

回收商:

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

简单绘图视图:

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

我尝试了很多 ratio 和 scaleType 但我似乎无法获得显示全高的那个(仅显示 90%)。宽度很好,但我似乎无法正确获得高度。哪个是获得适当方面的正确组合?(脸书喜欢)

4

2 回答 2

3

我真的不明白你在寻找什么样的比例类型,但它肯定会由 Fresco 的 lib 配置,具有以下属性之一:

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

假设您有一些固定高度和 100% 宽度的 imageView:

  <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/feedImage"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        fresco:actualImageScaleType="centerInside" />
于 2015-11-13T20:07:33.270 回答
2

我的假设是您有与父视图关联的边距。请完整链接您的 XML 文件,但很可能有一个设置了边距的 RelativeLayout。

另一件事,我在 SimpleDraweeView 中看到了这个android:layout_height="wrap_content" 。宽度将与父级匹配,高度设置为 wrap_content,因此如果没有这个,它不会将高度扩展为 100%。这就是为什么有 90% 的图像填充。更改为以下内容:

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

除此之外,我需要查看 XML 以确定是否有其他原因导致此问题!

于 2015-11-13T21:24:42.700 回答