I have a circular progress-bar and it works fine.But Background is not appearing, even though i have given shape for "background" in the xml drawable file and also progress starts from the right side of the circle (as shown in the figure). I want it to make it from the top.
Here is my code:
<ProgressBar
android:id="@+id/progressBarToday"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_centerInParent="true"
android:indeterminate="false"
android:max="60"
android:progress="0"
android:progressDrawable="@drawable/progressbar" />
progressbar.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"> <---not working!
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="7.0">
<solid android:color="@color/red"/>
</shape>
</item>
<item android:id="@android:id/progress">
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="7.0">
<solid android:color="@color/blue"/>
</shape>
</item>
</layer-list>
I use following code to set progress:
ProgressBar pb = (ProgressBar)FindViewById (Resource.Id.progressBarToday);
_progressBar.Progress = _progressCount;
Why the background is not appearing? and How can i make the progress start from the top?
Anyone please help, Thanks.
To start from the top, you can use "rotate
Yes. I am too late but this may help other. This code will return a bitmap image and can be used in a ImageView or ImageButton .
You need to add the following attribute to the background item:
Like so:
I got it working