我想創建一個內部發光的圓形進度條,我似乎無法使用漸變開始,中間和結束顏色繪製進度。圓形進度條中的漸變
我會分享我目前的做法。
background.xml
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring"
android:innerRadiusRatio="2.5"
android:thickness="10dp"
android:useLevel="false">
<gradient
android:startColor="#b6b6b6"
android:centerColor="#eeeeee"
android:endColor="#b6b6b6"
/>
</shape>
progress.xml
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="270"
android:toDegrees="270">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thickness="10dp"
android:useLevel="true"><!-- this line fixes the issue for lollipop api 21 -->
<gradient
android:angle="0"
android:startColor="#082a55"
android:centerColor="#0a3973"
android:endColor="#082a55"
android:useLevel="false" />
</shape>
</rotate>
mainactivity.xml
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="200dp"
android:layout_height="200dp"
android:indeterminate="false"
android:layout_centerInParent="true"
android:progressDrawable="@drawable/circular_progress_bar"
android:background="@drawable/cicle_shape"
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
android:progress="20" />
檢查我答,問我的情況下,任何的查詢 –