0
我對Android的定製圈進度我與繪製circular.xml的Android定製的空cicrle進度條的顏色問題
這裏做是我的進度:
<ProgressBar
android:id="@+id/circle_progress_id"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="40dp"
android:layout_height="40dp"
android:indeterminate="false"
android:max="100"
android:rotation="-90"
android:progressDrawable="@drawable/circular"
android:layout_toRightOf="@id/checkbox_id"
android:background="@drawable/circle_shape"/>
下面是從@代碼繪製/圓弧
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadiusRatio="3.4"
android:shape="ring"
android:thicknessRatio="9.0"
android:useLevel="true" >
<gradient
android:endColor="#4CAF50"
android:startColor="#4CAF50"
android:type="sweep"
android:useLevel="true" />
</shape>
</item>
</selector>
,從那以後它工作正常,並取得進展:
recyclerTaskHolder.progressBarStage.setProgress(getStageProgressValue(myTask));
但是,當它爲零時,它絕對是空的。 我需要顯示用戶空灰色進度條時,它是零進展。或者在零到100%之間時,用灰色顯示進度條的空白部分。
我試圖讓進度條
android:background="@drawable/circle_shape"
這裏的自定義背景是circle_shape.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadiusRatio="3.4"
android:shape="ring"
android:thicknessRatio="9.0"
android:useLevel="true"
android:visible="true">
<gradient
android:endColor="#000000"
android:startColor="#000000"
android:type="sweep"
android:useLevel="true" />
</shape>
</item>
</selector>
但它並沒有幫助我,空的進度條仍然是不可見的。