我想将 ImageView 放入 ListView 行中,使其适合设备屏幕的边缘。
这是我目前的布局:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:smoothScrollbar="true"
android:id="@android:id/list" />
</RelativeLayout>
在 custom_row.xml 中:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/img_item"
android:adjustViewBounds="true"/>
</RelativeLayout>
我正在使用 Picasso 库来加载图像。我已经尝试使用 Picasso 的加载器选项来使用 .centerCrop、.centerInside 和 .fit。没运气。
毕加索设置:
Picasso.with(context) //
.load(iim.getResized()) //
.placeholder(R.drawable.placeholder) //
.error(R.drawable.error)
.fit().centerInside()
.into(vh.item_image);
任何人都知道如何处理这个问题?