Progress Bars
The easiest way to set a progress bar in your application is to use the ProgressBarDrawable class when building a hierarchy:
1
.setProgressBarImage(new ProgressBarDrawable())
This shows the progress bar as a dark blue rectangle along the bottom of the Drawee.
Defining your own progress bar
If you wish to customize your own progress indicator, be aware that in order for it to accurately reflect progress while loading, it needs to override the Drawable.onLevelChange method:
1
2
3
4
5
6
7
8
9
10
class CustomProgressBar extends Drawable {
@Override
protected boolean 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
}
}
Example
The Fresco showcase app has a DraweeHierarchyFragment that demonstrates using a progress bar drawable.