Placeholder/Error/Fallback in Glide v4 [duplicate]

一曲冷凌霜 提交于 2019-12-05 05:47:34

try this

RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(R.mipmap.ic_launcher);
requestOptions.error(R.drawable.error_img);

Glide.with(this)
                .setDefaultRequestOptions(requestOptions)
                .load("")
                .into(imageViewPlaceholder);

Checkout migration details from here. Looks like they had lot more improvements.

You have new class RequestOptions:

RequestOptions options = new RequestOptions()
    .centerCrop()
    .placeholder(R.drawable.placeholder)
    .error(R.drawable.error)
    .priority(Priority.HIGH);

Then,

Glide.with(fragment/activity)
    .load(url)
    .apply(options)
    .into(imageView);

To learn more about Migration Details, you can go here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!