Можно ли сделать так, чтобы фото, которое я добавляю в recyclerview занимало всю площадь imageView?

Я использую библиотеку picasso и при добавлении фото в большом расширении - оно помещается, но растягивается по всей длине, и квадрат, в которое я помещаю изображение - уже не имеет никакого смысла, так как изображение прямоугольное.

введите сюда описание изображения

Layout

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="6dp">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    android:padding="6dp">

    <androidx.cardview.widget.CardView
        android:id="@+id/crd_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        app:cardCornerRadius="6dp">

        <ImageView
            android:id="@+id/img_list"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:background="@color/white"
            android:src="@drawable/ic_launcher_foreground" />
    </androidx.cardview.widget.CardView>

    <TextView
        android:id="@+id/txt_item"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginStart="20dp"
        android:layout_marginLeft="20dp"
        android:layout_toEndOf="@id/crd_image"
        android:layout_toRightOf="@id/crd_image"
        android:text="@string/app_name"
        android:textColor="@color/black"
        android:textSize="16sp" />
</RelativeLayout>

</androidx.cardview.widget.CardView>


Ответы (1 шт):

Автор решения: Shams

Добавьте scaleType в imageView

android:scaleType="centerCrop"
→ Ссылка