3. 设置默认图片及出错图片
public RequestCreator placeholder(int placeholderResId) {
//是否允许设置默认图片
if (!setPlaceholder) {
throw new IllegalStateException("Already explicitly declared as no placeholder.");
}
//默认图片资源不合法
if (placeholderResId == 0) {
throw new IllegalArgumentException("Placeholder image resource invalid.");
}
//已经设置了默认图片
if (placeholderDrawable != null) {
throw new IllegalStateException("Placeholder image already set.");
}
this.placeholderResId = placeholderResId;
return this;
}
//出错图片的处理逻辑与之类似 |