Android 在imageview中拉伸图像以适应xml格式的屏幕
我有可绘制的图像,需要作为背景。它需要伸展才能填满屏幕。。Android 在imageview中拉伸图像以适应xml格式的屏幕,android,xml,imageview,Android,Xml,Imageview,我有可绘制的图像,需要作为背景。它需要伸展才能填满屏幕。。 我知道如何使用java代码将图像拉伸到全屏。。但在XML中,它本身如何做到这一点。尝试使用此属性: android:scaleType="fitXY" 您可以找到其他用于调整大小的常量值。android:scaleType=“fitXY”将拉伸图像,以适合图像视图的完整大小。尝试像这样实现您的图像视图,并将ic_启动器更改为您自己尝试添加的图像名称 <ImageView android:id="@+id/mImage
我知道如何使用java代码将图像拉伸到全屏。。但在XML中,它本身如何做到这一点。尝试使用此属性:
android:scaleType="fitXY"
您可以找到其他用于调整大小的常量值。android:scaleType=“fitXY”将拉伸图像,以适合
图像视图的完整大小。尝试像这样实现您的图像视图,并将ic_启动器更改为您自己尝试添加的图像名称
<ImageView
android:id="@+id/mImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher" />
希望这会有帮助。谢谢我更喜欢使用scaleType=“centerCrop”。这样,图像就不会超出其原始比例