AnimatedPB is an Android library for creating customizable and animated progress bars. It supports various shapes like polls and circles, allows for animation customization (linear, ease-in, ease-out, bounce), and offers extensive styling options for progress bars and containers. With easy-to-use attributes, you can set colors, labels, and more to create engaging UI elements.

- Customizable colors and shapes
- Supports circular and poll progress bars
- Animated progress with different types (linear, ease-in, ease-out, bounce)
- Flexible margins, corner radii, and dimensions
- Display text labels and values inside progress bars
Add the following dependency to your build.gradle
file:
<!-- In your project-level build.gradle -->
repositories {
mavenCentral()
}
Add the dependency:
<!-- In your app-level build.gradle -->
dependencies {
implementation 'com.example:animatedpb:1.0.0'
}
<com.example.animatedpb.Models.AnimatedPB
android:id="@+id/my_animatedPB"
android:layout_width="match_parent"
android:layout_height="40dp"
app:progressColor="#4CAF50"
app:containerColor="#F5F5F5"
app:barLabel="Linear"
app:barShape="poll"
app:minValue="0"
app:maxValue="100"
app:progress="0"
app:animationType="linear"
app:valueToDisplay="number"
app:containerCornerRadius="0"
app:progressCornerRadius="0"
app:labelColor="#212121"
app:valueColor="#212121"
/>
You can add an OnClick Listener to the ProgressBar and implement your own Functionality

my_animatedPB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Progressbar clicked", Toast.LENGTH_SHORT).show();
}
});
The following attributes can be modified dynamically during runtime by calling the appropriate setter methods:
- Bar Label: Set or update the text displayed on the progress bar.
my_animatedPB.setBarLabel(String barLabel);
- Label Color: Change the color of the label text on the progress bar.
my_animatedPB.setLabelColor(int labelColor);
- Label Text Size: Modify the size of the label text on the progress bar.
my_animatedPB.setLabelTextSize(int labelTextSize);
- Value Color: Set the color for the value displayed inside the progress bar.
my_animatedPB.setValueColor(int valueColor);
- Value to Display: Choose whether to display a number, percentage, or none.
my_animatedPB.setValueToDisplay(int valueToDisplay); // Can be number, percentage, or none
- Container Corner Radius: Adjust the corner radius for the container of the progress bar.
my_animatedPB.setContainerCornerRadius(int containerCornerRadius);
- Progress Corner Radius: Adjust the corner radius for the progress bar itself.
my_animatedPB.setProgressCornerRadius(int progressCornerRadius);
- Progress Color: Change the color of the progress bar.
my_animatedPB.setProgressColor(int progressColor);
- Container Color: Modify the color of the background container for the progress bar.
my_animatedPB.setContainerColor(int containerColor);
- Progress Margin: Set margins around the progress bar (top, left, bottom, right).
my_animatedPB.setProgressMargin(int progressMarginTop, int progressMarginLeft, int progressMarginBottom, int progressMarginRight);
Here’s a table of all customizable attributes for AnimatedPB:
Attribute | Description | Example | Default Value |
---|---|---|---|
progressColor |
Sets the color of the progress bar | #4CAF50 |
#005ECB |
containerColor |
Sets the background color of the progress bar's container | #F5F5F5 |
#E1BEE7 |
barLabel |
Text label to display within the progress bar | Linear |
null |
barShape |
Determines the shape of the progress bar. Options: poll (0), circle (1) |
poll |
0 (poll) |
minValue |
Sets the minimum value for the progress bar | 0 |
0 |
maxValue |
Sets the maximum value for the progress bar | 100 |
100 |
progress |
Initial progress value | 50 |
0 |
animationType |
Sets the animation type for progress. Options: linear (0), ease_out (1), ease_in (2), bounce (3) |
linear |
0 (linear) |
valueToDisplay |
Determines how to display the progress value. Options: number (0), percentage (1), none (2) |
number |
0 (number) |
containerCornerRadius |
Radius of the container's corners | 20 |
0 |
progressCornerRadius |
Radius of the progress bar's corners | 10 |
0 |
labelColor |
Color of the progress bar's label text | #FFFFFF |
#212121 |
labelTextSize |
Size of the label text | 16 |
14 |
valueColor |
Color of the displayed value inside the progress bar | #FFFFFF |
#212121 |
progressMarginTop |
Margin of the progress bar from the top | 10dp |
0 |
progressMarginLeft |
Margin of the progress bar from the left | 18dp |
0 |
progressMarginBottom |
Margin of the progress bar from the bottom | 10dp |
0 |
progressMarginRight |
Margin of the progress bar from the right | 18dp |
0 |
animDurationMillis |
Duration of the animation in milliseconds | 1000 |
1000 |