Glide4 displays the default image when it fails to load

// Create a DRAWABLE 
TextDrawable drawable according to the first letter of the URL = TextDrawable.builder() 
        .buildRoundRect(getUrlFirstLetter(item.getUrl()), getRandomColor(item.getUrl()), 10); 
viewHolder.ivLogo.setImageDrawable(drawable) ; 
// When loading from the network fails, display this DRAWABLE 
RequestOptions options = new RequestOptions().placeholder(drawable); 
Glide.with(context).load(getFaviconUrl(item.getUrl())).apply(options) .into(viewHolder.ivLogo);

Guess you like

Origin blog.csdn.net/wuzhong8809/article/details/107371523