我在我的Activty中使用了一个圆形的ProgressBar。我的问题是,只有BG颜色在改变,它的颜色不能正确改变。因此,如何在没有BG的情况下更改ProgressBar的颜色。我试过这个线程-如何更改进度条的默认颜色?
您可以在xml文件中完成所有操作,经过一番搜索,我得到了答案:
您可以取得条形码:
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:max="100"
android:indeterminateDrawable="@drawable/progress"
/>
可绘制进度由一个旋转的环组成,您的选择的渐变色是这样的:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0"
android:toDegrees="360">
<shape android:shape="ring" android:innerRadiusRatio="3"
android:thicknessRatio="8" android:useLevel="false">
<size android:width="76dip" android:height="76dip" />
<gradient android:type="sweep" android:useLevel="false"
android:startColor="#007700"
android:endColor="#115511"
android:angle="0"
/>
</shape>
</rotate>
就是这样,请给这个答案评分:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句