Java 使用Glide库加载图像以填充屏幕
我正在尝试使用glide库加载一个背景图像,以便它填满整个屏幕。我有以下用于布局的xmlJava 使用Glide库加载图像以填充屏幕,java,android,android-glide,Java,Android,Android Glide,我正在尝试使用glide库加载一个背景图像,以便它填满整个屏幕。我有以下用于布局的xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:adjustViewBounds="true"
android:id="@+id/backgroundImage"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="@layout/signup_layout"/>
</RelativeLayout>
运行代码后,图像在屏幕的左右两侧都有空白,但它会填满图像的整个高度。我尝试同时使用.fitCenter()和.centerCrop(),但图像会变得像素化。自从使用以来,它无法填充整个屏幕
android:adjustViewBounds="true"
哪些订单():
如果希望ImageView将其边界调整为
保留其可拉伸的纵横比
同样,这是API17之前版本的buggy,如上所述
如果你想填满整个屏幕,你应该删除<代码> Android:ActudiVIEW界限,也许考虑使用< /P>
android:scaleType="fitCenter"
你一定是喝醉了,没有centerFit ScaleType此功能运行完美,高度设置为包裹内容,宽度与父级匹配,我的图像与宽度和动态高度完美匹配。
android:scaleType="fitCenter"