I am using the "normal" circle ProgressBar of Android which looks like this:
So, what I would like to do is to change the color, thickness and the corners (with cornerradius) of this ProgressBar.
I've found some examples for doing this stuff, but however it only was for horizontal ProgressBars, but I would like to keep this original ProgressBar.
Thank you very much!
This example demonstrates how do I make circle custom progress bar in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.
You try set Grid width=100 or bigger. And the ProgressRing should set HorizontalAlignment and verticalAlignment to Stretch and not any width,height and margin.
In Android, SeekBar is an extension of ProgressBar that adds a draggable thumb, a user can touch the thumb and drag left or right to set the value for current progress. SeekBar is one of the very useful user interface element in Android that allows the selection of integer values using a natural user interface.
A progress bar is essentially a rotate
animation drawable. Here's something we use that is thinner with a different color gradient. You can see the use of thickness
for width and start
and end
color.
Tweak to your liking:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="720" >
<shape
android:shape="ring"
android:thickness="@dimen/progress_circle_thickness"
android:useLevel="false" >
<gradient
android:angle="0"
android:endColor="@color/progress_circle"
android:startColor="@android:color/transparent"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
and use in your layout something like this:
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminateDrawable="@drawable/progress_circle"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With