如何更改android不确定的ProgressBar颜色? [英] How to change android indeterminate ProgressBar color?
本文介绍了如何更改android不确定的ProgressBar颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何将不确定的 ProgressBar
颜色从基础白色/灰色更改为黑色?当我更改 indeterminateDrawable
时,我得到的是静态图像而不是移动的动画进度条.有什么办法可以简单地在 XML 中做到这一点吗?
I would like to know how I can change indeterminate ProgressBar
color from basis white/grey color to black ? When I change the indeterminateDrawable
, I get a static image instead of a moving animated progressBar. Is there any way to do it simply in XML?
推荐答案
progressBar.getIndeterminateDrawable().setColorFilter(
getResources().getColor(Your_Color),
android.graphics.PorterDuff.Mode.SRC_IN);
并将 Your_Color 替换为所需的颜色,例如:R.color.your_color_code
and replace Your_Color with the desired color like: R.color.your_color_code
这篇关于如何更改android不确定的ProgressBar颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文