我尝试添加
ImageView
我CardView
,但我不知道如何 设置的ImageView
内图像具有全宽 (match_parent
)和高度为wrap_content
!默认情况下,将有 在ImageView的一些空间(底部和顶部的部分,取决于宽度和 高度图象的),你看下面:如何删除的ImageView的空白空间不裁剪他们
另一个例子:
任何方式删除这些空没有裁剪图像的空间?
这里是我的布局:
<?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>
'scaletype'会裁剪图像,我自己找到了解决方法:您可以使用android:adjustViewBounds =“true”'图像将像instagram图像一样缩放 –