Glide 正在加载一半图像

5 android android-imageview android-drawable android-glide

当我尝试加载图像时,我得到了这个结果:

结果

这是我的简单代码:

Glide.with(this).load(R.drawable.girl_with_coffee_and_phone)
                .placeholder(R.color.colorPrimary)
                .into(mBackgroundImage);
Run Code Online (Sandbox Code Playgroud)

这是我的活动布局:

<?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>
Run Code Online (Sandbox Code Playgroud)

难道我做错了什么?

日志:

D/OpenGLRenderer: endAllActiveAnimators on 0x7842bfdc00 (InsetDrawable) with handle 0x783169e820
Run Code Online (Sandbox Code Playgroud)

Yor*_*dan 0

尝试

  Glide.with(this).load(R.drawable.girl_with_coffee_and_phone)
                .centerCrop()
                .into(mBackgroundImage);
Run Code Online (Sandbox Code Playgroud)

从 xml 文件中删除 android:scaleType 参数。

在活动中你将拥有:

ImageView mBackgroundImage= (ImageView)findViewById(R.id.image_background);
Run Code Online (Sandbox Code Playgroud)