如何改变一个不确定的进度条的颜色? [英] How to change the color of an indefinite ProgressBar?

查看:587
本文介绍了如何改变一个不确定的进度条的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的风格进度:风格=机器人:ATTR /安卓:progressBarStyleSmall

I have a progressbar with the following style: style="?android:attr/android:progressBarStyleSmall"

可悲的是酒吧几乎是白色的,在我的情况下,显示在白色背景上。 该进度是因为,几乎看不见。

Sadly the bar is nearly white and in my case displayed on a white background. The progressbar is nearly invisible because of that.

我怎样才能改变进度的颜色?深灰色的将是巨大的。

How can I change the color of the progressbar? A darker grey would be great.

推荐答案

之所以酒吧是彩色的,因为你选择的风格。这是一个固定式的,并使用系统主题UI元素的代

The reason why the bar is of that color is because of the style you have selected. That is a fixed style and uses the system themes for the generation of UI elements.

看从<一个源$ C ​​$ C href="http://www.google.com/$c$csearch/p?hl=en#uX1GffpyOZk/core/res/res/values/themes.xml&q=progressBarStyleSmall&d=3">here.这progressBarStyleSmall属性使用定义的<一个样式href="http://www.google.com/$c$csearch/p?hl=en#uX1GffpyOZk/core/res/res/values/styles.xml&q=progressBarStyleSmall&d=3">here.

Look at the source code from here. This progressBarStyleSmall attribute uses the styles defined here.

<style name="Widget.ProgressBar.Small">
    <item name="android:indeterminateDrawable">@android:drawable/progress_small_white</item>
    <item name="android:minWidth">16dip</item>
    <item name="android:maxWidth">16dip</item>
    <item name="android:minHeight">16dip</item>
    <item name="android:maxHeight">16dip</item>
</style>

只要创建以下的Andr​​oid源$ C ​​$ c中的例子自定义样式。您将需要更换的android:indeterminateDrawable你想要什么

Just create a custom style following the example from the android source code. You would need to replace the android:indeterminateDrawable to what you want.

这篇关于如何改变一个不确定的进度条的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆