首先是普通的使用
Glide.with(mContext).load(item.getBooksPicture())
.into((ImageView) helper.getView(R.id.sculpture_img));
带缩略图的使用
你传了0.1f作为参数,那么Glide则会显示原图大小的10%。如果原图的尺寸是1000x1000像素,那么缩略图就是100x100像素。由于缩略图会比ImageView要小许多,所以你要确保一个准确的缩放比例。
Glide.with(mContext).load(item.getBooksPicture())
.thumbnail(0.1f)
.into((ImageView) helper.getView(R.id.sculpture_img));
当网络不佳或者图片url为空再比如图片加载失败的使用
RequestOptions options = new RequestOptions()
// .placeholder(R.drawable.ic_launcher_background)//图片加载出来前,显示的图片
// .fallback( R.drawable.ic_launcher_background) //url为空的时候,显示的图片
// .error(drawable.ic_launcher_background);//图片加载失败后,显示的图片
Glide.with(mContext).load(item.getBooksPicture())
// .apply(options)
.thumbnail(0.1f)
.into((ImageView) helper.getView(R.id.sculpture_img));