From 4c64a669efb83b48024de6b6a1e03a0876627dda Mon Sep 17 00:00:00 2001 From: chad <54050520@qq.com> Date: Wed, 27 Apr 2016 15:07:33 +0800 Subject: [PATCH] add setImageUrl(int viewId, String imageUrl, int defResourceId) --- .../java/com/chad/library/adapter/base/BaseViewHolder.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/src/main/java/com/chad/library/adapter/base/BaseViewHolder.java b/library/src/main/java/com/chad/library/adapter/base/BaseViewHolder.java index 97fe43fec..f461030b4 100755 --- a/library/src/main/java/com/chad/library/adapter/base/BaseViewHolder.java +++ b/library/src/main/java/com/chad/library/adapter/base/BaseViewHolder.java @@ -158,6 +158,12 @@ public BaseViewHolder setImageUrl(int viewId, String imageUrl) { return this; } + public BaseViewHolder setImageUrl(int viewId, String imageUrl, int defResourceId) { + ImageView view = getView(viewId); + Glide.with(context).load(imageUrl).crossFade().placeholder(defResourceId).into(view); + return this; + } + /** * Add an action to set the image of an image view. Can be called multiple times.