I want to fit ImageView inside a ListView row so that it fits to the edge of device's screen.
This is my current layout:
<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>
In the 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>
I'm using Picasso library to load the image. I've tried using .centerCrop, .centerInside and .fit using Picasso's loader option. No luck.
Picasso settings:
Picasso.with(context) //
.load(iim.getResized()) //
.placeholder(R.drawable.placeholder) //
.error(R.drawable.error)
.fit().centerInside()
.into(vh.item_image);
Anyone knows how to deal with this problem?
Try with:
android:scaleType="centerCrop"
in the xml