我想创建一个内部发光的圆形进度条,我似乎无法使用渐变开始,中间和结束颜色绘制进度。圆形进度条中的渐变
我会分享我目前的做法。
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" />
检查我答,问我的情况下,任何的查询 –