Add this in your root build.gradle
file (not your module build.gradle
file):
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Add this to your module's build.gradle
file (make sure the version matches the JitPack badge above):
dependencies {
...
compile 'com.github.love-311:PercentProgressBar:1.0'
}
A simple in xml:
<www.lee311.percentprogressbar.PercentProgressBar
android:id="@+id/percent_progress_bar"
android:layout_width="368dp"
android:layout_height="205dp"
app:bgColor="@color/red"
app:iconBitmap="@mipmap/transfer_icon_handle"
app:iconPadding="20dp"
app:progressColor="@color/green"
app:progressMax="100"
app:progressOrientation="horizontal"
app:progressValue="0"/>
to set the total value:
mPercentProgressBar.setTotal(329990);
to set current progress:
mPercentProgressBar.setProgress(30);
to set the text size:
mPercentProgressBar.setTextSize(64);
to set the text color:
mPercentProgressBar.setTextColor(getResources().getColor(R.color.colorPrimary));
to set the listener of the progress chanage:
mPercentProgressBar.setChangedListener(new PercentProgressBar.OnProgressChangedListener() {
@Override
public void onProgressChanged(int currentValue, int percent) {
}
});