Java 图像未占据布局中的完整图像视图
我创建了一个图库,当其中一个被单击并在其他活动中显示时,它具有默认图像,但我的问题是,在加载图像时,它不会占据整个屏幕 这里是xml-Java 图像未占据布局中的完整图像视图,java,android,android-imageview,android-image,Java,Android,Android Imageview,Android Image,我创建了一个图库,当其中一个被单击并在其他活动中显示时,它具有默认图像,但我的问题是,在加载图像时,它不会占据整个屏幕 这里是xml- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drag_activity_layout" androi
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drag_activity_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DragActivity" >
<ImageView
android:id="@+id/imageViewEdit"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/i1" />
</RelativeLayout>
是图像占据整个图像视图的一种方式。
专家们请帮帮我,我是android新手。提前感谢。更改
imgView.setImageResource(ImageId);
到
在ImageView上设置
android:scaleType
属性,类似centerCrop的内容应填充屏幕更改ImageView的属性。将此添加到您的ImageView
标签:
android:scaleType = "fitCenter"
使用imageView.setBackground()属性查看此链接
将android:scaleType=“FIT_XY”
添加到您的ImageView中
imgView.setBackgroundResource(ImageId);
android:scaleType = "fitCenter"