我为我的应用程序创建了这个进度条,但我无法获得看起来会变成红色或蓝色之类的黄色橙色。
<ProgressBar
android:id="@+id/progress_bar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="250sp"
android:layout_height="wrap_content"
android:progress="2"
android:layout_marginTop="82dp"
android:max="3"
android:indeterminate="false"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true" />
上面是我的进度条xml代码。
有帮助吗? :)
提前致谢! :)
最佳答案
如果android版本是5.0及以上你只需要设置
android:indeterminateTint="@color/BLACK"
android:indeterminateTintMode="src_in"
对于低版本我用这个
mProgressBar.getIndeterminateDrawable().setColorFilter(getResources()
.getColor(R.color.primary_color),PorterDuff.Mode.SRC_IN);
关于android - 如何更改进度条进度颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38120065/