Round a corner of a circular progress bar
Finally I used this library https://github.com/lopspower/CircularProgressBar it's very similar to what i wanted
Android custom circular ProgressBar direction
I guess you're using an rtl language? You can force the progress bar to an ltr or clockwise direction by setting the layoutDirection
property on your ProgressBar
.
<ProgressBar
...
android:layoutDirection="ltr" />
Android: Start the circular progress bar from top (270°)
Try specifying rotation degrees to your progress items.
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/progress">
<rotate
android:fromDegrees="270"
android:toDegrees="270"
android:pivotX="50%"
android:pivotY="50%" >
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thicknessRatio="25.0" >
<gradient
android:centerColor="@color/gray"
android:endColor="@color/gray"
android:startColor="@color/gray"
android:type="sweep" />
</shape>
</rotate>
</item>
<item android:id="@android:id/secondaryProgress">
<rotate
android:fromDegrees="270"
android:toDegrees="270"
android:pivotX="50%"
android:pivotY="50%" >
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thicknessRatio="25.0" >
<gradient
android:centerColor="@color/green"
android:endColor="@color/green"
android:startColor="@color/green"
android:type="sweep" />
</shape>
</rotate>
</item>
</layer-list>
How to Swing image like pendulum in android?
I had the exact same problem, and ended up with an xml-only solution: http://blog.sqisland.com/2012/01/android-pendulum-animation.html
How To Make Circle Custom Progress Bar in Android
The best two libraries I found on the net are on github:
- https://github.com/Todd-Davies/ProgressWheel
- https://github.com/f2prateek/progressbutton?source=c
Hope that will help you
Custom circular progressbar
You are searching for lzyzsd/CircleProgress library.
<com.github.lzyzsd.circleprogress.ArcProgress
android:id="@+id/arc_progress"
android:background="#214193"
android:layout_marginLeft="50dp"
android:layout_width="100dp"
android:layout_height="100dp"
custom:arc_progress="55"
custom:arc_bottom_text="MEMORY"/>
You can customize it by attributes.
<declare-styleable name="ArcProgress">
<attr name="arc_progress" format="integer"/>
<attr name="arc_angle" format="float"/>
<attr name="arc_stroke_width" format="dimension"/>
<attr name="arc_max" format="integer"/>
<attr name="arc_unfinished_color" format="color"/>
<attr name="arc_finished_color" format="color"/>
<attr name="arc_text_size" format="dimension"/>
<attr name="arc_text_color" format="color"/>
<attr name="arc_suffix_text" format="string"/>
<attr name="arc_suffix_text_size" format="dimension"/>
<attr name="arc_suffix_text_padding" format="dimension"/>
<attr name="arc_bottom_text" format="string"/>
<attr name="arc_bottom_text_size" format="dimension"/>
</declare-styleable>
Visit github page for more customization.
Create Custom circular progressbar with two layer
Create custom drawable xml file and set this drawbale to your progressbar
Check below answer
<item>
<rotate
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:toDegrees="1080">
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="12"
android:useLevel="false">
<size
android:width="76dip"
android:height="76dip"/>
<gradient
android:angle="0"
android:endColor="@color/colorPrimary"
android:startColor="@color/colorPrimary"
android:type="linear"
android:useLevel="false"
/>
</shape>
</rotate>
</item>
<item>
<rotate
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:toDegrees="1080">
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="22"
android:useLevel="false">
<size
android:width="76dip"
android:height="76dip"/>
<gradient
android:angle="0"
android:endColor="@android:color/white"
android:startColor="@android:color/transparent"
android:type="sweep"
android:useLevel="false"
/>
</shape>
</rotate>
</item>
set this drawable to your progress bar
<ProgressBar
android:id="@+id/loadingbar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/img"
android:layout_centerInParent="true"
android:indeterminateDrawable="@drawable/custom_progress_bar" />
Hope this will help you
Put your second color instead of @color/colorPrimary
How to have a ProgressBar circular and in determinate mode?
Unfortunately, this is not possible with stock Android ProgressBar. Look for external libraries like:
http://github.com/dinuscxj/CircleProgressBar
Related Topics
How to Show Dependencies Tree in Android Studio
Best Practice: Asynctask During Orientation Change
How to Create a Listview with Rounded Corners in Android
Com.Google.Android.Gms:Play-Services-Measurement-Base Is Being Requested by Various Other Libraries
Firebase Runtransaction Not Working - Mutabledata Is Null
Changing Viewpager to Enable Infinite Page Scrolling
How to Redirect My Log Output from Logcat to the Sd-Card on an Android Device
How to Disable Scrolling on a Viewpager
How to Use Library That Used Android Support with Androidx Projects
Android - Detect Phone Unlock Event, Not Screen On
How to Hide Action Bar Before Activity Is Created, and Then Show It Again
Enable/Disable Data Connection in Android Programmatically
How to Programmatically Open the Permission Screen for a Specific App on Android 6.0 (Marshmallow)
How to Hide Soft Keyboard When Activity Starts
Updating Paging 3 Alpha to Stable Cause Indexing Issue Android