2017-07-19 18 views
4

我使用最新版本的Glide截至目前为glide:4.0.0-RC1并且无法找到像占位符,错误,后备e.t.c这样的方法。可能他们已经提供了替代它,但我没有得到它。任何人都知道在这个版本中有替代品吗?Glide v4中的占位符/错误/回退

+0

阅读Glide的文档。可能会有一个描述。 – Piyush

回答

9

尝试从here这个

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

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

它的工作,谢谢 – Safeer

1

结帐迁移的详细信息。看起来他们有很多改进。

您有新的类RequestOptions

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

然后,

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

要了解更多有关迁移细节,你可以去here