返回首页 Fresco 中文版

配置和使用

DRAWEE 指南

IMAGE PIPELINE 指南

第三方类库

进度条

要显示进度,最简单的办法就是在 构建 hierarchy 时使用 ProgressBarDrawable,如下:

.setProgressBarImage(new ProgressBarDrawable())

这样,在 Drawee 的底部就会有一个深蓝色的矩形进度条。

自定义进度条

如果你想自定义进度条,请注意,如果想精确显示加载进度,需要重写 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
   }
}
上一篇: Drawee的各种效果... 下一篇: 缩放