白色背景上是否有可见的黑色进度条?

发布于 2024-09-01 10:18:35 字数 53 浏览 2 评论 0原文

Android 上的默认进度轮在背景为白色时显示效果不佳,几乎看不见。我该如何解决这个问题?

The default progress wheel on Android doesn't display well when the background is white, it's barely visible. How can I fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

深爱不及久伴 2024-09-08 10:18:35

如果您查看内置的 styles.xml 文件并浏览平台的内置可绘制对象,您会发现解决方案非常简单。您可以使用“style”属性来使用反向进度条:

<ProgressBar
    android:id="@+id/progress_bar"
    android:layout_width="40dip"
    android:layout_height="40dip"
    android:padding="6dp"
    android:indeterminate="true"
    style="?android:attr/progressBarStyleInverse"
    />

If you look at the built in styles.xml file and poke around the platform's built in drawables, it turns out the solution is pretty simple. You can use the "style" attribute to use the inverse progress bar:

<ProgressBar
    android:id="@+id/progress_bar"
    android:layout_width="40dip"
    android:layout_height="40dip"
    android:padding="6dp"
    android:indeterminate="true"
    style="?android:attr/progressBarStyleInverse"
    />
や莫失莫忘 2024-09-08 10:18:35

确保您的清单中的主题是否为白色背景,以将其设置为 @android:style/Theme.Light。这为所有小部件提供了使用浅色背景的资源。

Be sure if you have a white background to set the theme in your manifest to @android:style/Theme.Light. This provides resources for all of the widgets to go with a light background.

葮薆情 2024-09-08 10:18:35

我认为没有办法解决这个问题,因为进度条依赖于 sdk。 1.5 上为橙色,1.6 上为白色等...某些设备上为绿色,等等...

您必须使用自己的图形来实现/覆盖它才能更改它。

我遇到了类似的问题,我通过在进度条上设置对比背景来解决它。 (50% 透明黑色)

这是使用水平进度条实现自定义颜色的类似问题:
如何在 Android 中更改进度条的进度颜色

我认为圆形有点不同,但可能并非不可能;-)

I dont think there is way to fix this since the progressbar is sdk dependant. orange on 1.5, white on 1.6 etc... green on some devices, etc etc...

Your would have to implement/override it with your own graphics to change it.

I had the similar problem, i solved it by setting a constrasting background on the progressbar. (50% transparent black)

Here is similar issue using the horisontal progressbar implementing a custom color:
How to change progress bar's progress color in Android

The circular is abit diffrent i think, but probably not impossible ;-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文