Glide 无法正确加载图像

Glide not loading image properly

这里的图片没有完全加载。我不知道为什么。不知何故一半占位符和一半图像。有时加载没有任何问题。

我正在使用

implementation 'com.github.bumptech.glide:glide:3.7.0'

这是我的代码

val headerView = nav_view.getHeaderView(0)
Glide.with(act).load(userdata.image).placeholder(R.drawable.ic_male).thumbnail(0.2f).into(headerView.imgNavDp)

XML

<de.hdodenhof.circleimageview.CircleImageView
            android:layout_marginLeft="@dimen/dim_5"
            android:id="@+id/imgNavDp"
            android:layout_width="@dimen/dim_76"
            android:layout_height="@dimen/dim_76"
            android:elevation="@dimen/dim_10"
            android:layout_gravity="center_vertical"
            app:srcCompat="@mipmap/ic_launcher_round" />

在 Glide 中有一个解决加载错误问题的方法

导入这个,并保持编译sdk版本为27

compile 'com.github.bumptech.glide:glide:3.8.0'

然后使用此代码

Glide.with(context)
        .load(userdata.image)
        .placeholder(R.drawable.ic_male)
        .error(R.drawable.imagenotfound)
        .listener(new RequestListener<String, GlideDrawable>() {
            @Override
            public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
                // log exception
                Log.e("TAG", handle error case", e);
                return false; 
            }

            @Override
            public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                 Log.e("TAG", handle success case here", e);
                return false;
            }
        })
        .into(headerView.imgNavDp);

xml

中删除
 app:srcCompat="@mipmap/ic_launcher_round"