当我尝试加载图像时,我得到以下结果:
这是我的简单代码:
Glide.with(this).load(R.drawable.girl_with_coffee_and_phone)
.placeholder(R.color.colorPrimary)
.into(mBackgroundImage);
这是我的 Activity 布局:
<?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:id="@+id/image_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</RelativeLayout>
我做错了什么吗?
日志:
D/OpenGLRenderer: endAllActiveAnimators on 0x7842bfdc00 (InsetDrawable) with handle 0x783169e820
最佳答案
尝试
Glide.with(this).load(R.drawable.girl_with_coffee_and_phone)
.centerCrop()
.into(mBackgroundImage);
从 xml 文件中删除 android:scaleType 参数。
在 Activity 中您将拥有:
ImageView mBackgroundImage= (ImageView)findViewById(R.id.image_background);
关于android - Glide 正在加载半张图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39524604/