我有一个圆形的进度条,它运作得很好。但是背景没有出现,尽管我在xml可绘制文件中为"background"指定了形状,而且进度条从圆的右侧开始(如图所示)。我希望它从顶部开始。
这是我的代码:
<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" />
进度条.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>
我使用以下代码来设置进度:
ProgressBar pb = (ProgressBar)FindViewById (Resource.Id.progressBarToday);
_progressBar.Progress = _progressCount;
为什么背景没有出现?我该如何让进度条从顶部开始?
请帮忙解决,谢谢。