2017-07-19 41 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