1

I want to create Custom ProgressBar with style Spinner as below:

enter image description here

I have tried following way to achieve this:

layout.xml

<ProgressBar
        android:id="@+id/pb_capture_video"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_centerInParent="true"
        android:indeterminate="false"
        android:max="60"
        android:indeterminateDrawable="@drawable/layer_list_progress_bar_background"
        android:progress="30"
        android:progressDrawable="@drawable/layer_list_progress_bar_foreground"/>

layer_list_progress_bar_background.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
    <shape android:shape="oval">
        <stroke
            android:width="1dp"
            android:color="@android:color/white" />
    </shape>
</item>

layer_list_progress_bar_foreground.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/progress">
    <shape android:shape="oval">
        <stroke
            android:width="1dp"
            android:color="@color/colorAccent" />
    </shape>
</item>

But, I not able to display progress. Output of my code is as below:

enter image description here

Am I going wrong somewhere ? Is there anyway I can achieve what I want ?

If it seems this is not the right way, please suggest me some another.

Chintan Soni
  • 24,761
  • 25
  • 106
  • 174

1 Answers1

0

Its not that simple as you think of. You have to make use of animation in Java. Here is a solution.

Saeed Sharman
  • 765
  • 5
  • 24