2012-06-25 112 views
0

我试图tu在我的应用程序中自定义水平进度条。我希望它有尖角(无半径)和蓝色(不是默认的黄色或混合颜色,所以我也不想使用渐变)。我提到这两件事的原因是,在我发现的每个示例代码中,进度条颜色正在使用渐变而不是简单颜色变为混色。例如,在这个帖子:Android:自定义水平进度条

How to change progress bar's progress color in Android

我试图修改此代码,但没有运气。我的问题是在上面链接的问题的答案中,代码的三个部分是什么意思?我的意思是

@android:id/background 
@android:id/secondaryProgress 
@android:id/progress 

此外,当我试图让使用Ctrl +空格键从Eclipse一些帮助,它不可能给我任何由于内容可协助在该位置wasnt。我只希望我的进度条更改为简单的颜色而不是圆角。

谢谢!

回答

1

我偷了你链接的答案。类似的东西应该为你工作:

<!-- this is the Background Shape of the ProgressBar --> 
<item android:id="@android:id/background"> 
    <shape> 
     <!-- you don't want round edges, so I removed it here. 
      We dont even need a gradient, replace it with solid --> 
     <solid 
     android:color="Your bg color" /> 
    </shape> 
</item> 

您可以相应地修改,另外,其中的进步通常是黄色的叠加和二次灰色阴影黄色覆盖。

阅读本documentation进一步参考

+0

完美的作品,谢谢! :) –