本教程內(nèi)容來源于:http://fresco-cn.org
采用 知識共享 署名 4.0 國際 許可協(xié)議 進(jìn)行許可
要顯示進(jìn)度,最簡單的辦法就是在 構(gòu)建 hierarchy 時使用 ProgressBarDrawable,如下:
.setProgressBarImage(new ProgressBarDrawable())
這樣,在 Drawee 的底部就會有一個深藍(lán)色的矩形進(jìn)度條。
如果你想自定義進(jìn)度條,請注意,如果想精確顯示加載進(jìn)度,需要重寫 Drawable.onLevelChange:
class CustomProgressBar extends Drawable {
@Override
protected void onLevelChange(int level) {
// level is on a scale of 0-10,000
// where 10,000 means fully downloaded
// your app's logic to change the drawable's
// appearance here based on progress
}
}