I am trying to draw something akin to a progress bar. However, in my case, the progress bar is a circle with a sweeping arc of a different color as shown below (Figure 2 shows a snapshot of the design with some progress indicated by the yellow color). Once the job is complete, the entire circle would become yellow.
To make this I would like to create a circle using xml layout and I am able to do that with following code:
In res/drawable/circle.xml
<solid android:color="@color/red" />
<size
android:height="200dp"
android:width="200dp" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
In my main layout I just set this as a background to a framelayout...
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle" >
</FrameLayout>
</LinearLayout>
I know how to draw arcs using the example given at android demo code at http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/Arcs.html
I am struggling a bit on how to combine these two to create a sweeping motion. I know we have to create a thread and create an onDraw like the one in the demo - but how do I set the sweeping arc center to be at the drawn circle's center? And how would the java code look like (in the activity)? Thanx!