如何在不裁剪图像视图的情况下删除空白区域

how to remove empty spaces of imageview without cropping them

I'm trying to add a ImageView to my CardView but i don't know how to set image inside of ImageView that has a Full Width (match_parent) and a wrap_content height ! By default there would be some spaces in Imageview (bottom and top parts, depend on width and height of image) as you see below :

any way to remove these empty spaces without cropping images ?

这是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardview2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
app:cardElevation="3dp">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:id="@+id/cardviewLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ryan_gosling"
            />
    </LinearLayout>

</RelativeLayout>
</android.support.v7.widget.CardView>

好的,问题已解决。
一个非常简单的代码:

android:adjustViewBounds="true"

您可以尝试将scaletype 添加到imageview。这实际上会根据您赋予的价值来缩放图像。 Here you can refer it.