本教程內(nèi)容來(lái)源于:http://fresco-cn.org
采用 知識(shí)共享 署名 4.0 國(guó)際 許可協(xié)議 進(jìn)行許可
要顯示進(jìn)度,最簡(jiǎn)單的辦法就是在 構(gòu)建 hierarchy 時(shí)使用 ProgressBarDrawable,如下:
.setProgressBarImage(new ProgressBarDrawable())
這樣,在 Drawee 的底部就會(huì)有一個(gè)深藍(lán)色的矩形進(jìn)度條。
如果你想自定義進(jìn)度條,請(qǐng)注意,如果想精確顯示加載進(jìn)度,需要重寫(xiě) 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
}
}