我有一个ImageView,它的高度和宽度都设置为“fill_parent”,使用相同值设置的RelativeLayout。
将图片的scaleType设置为"fitXY"
以下是XML布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="@drawable/background_image" />
</RelativeLayout>
适应宽度和高度,但是图片被拉伸了。