Fresco 进度条
进度条
本教程内容来源于:http://fresco-cn.org
采用 知识共享 署名 4.0 国际 许可协议 进行许可
要显示进度,最简单的办法就是在 构建 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
}
}内容许可 来源网站为 http://frescolib.org/ 经 廖祜秋 授权发布, 采用 知识共享署名 4.0 国际许可协议(CC BY) 进行许可。