简体   繁体   English

如何在JFoenix的进度条上更改颜色

[英]How to change color on JFoenix's progress bar

I am trying to change the color of the progress-bar found on the JFoenix's library ( http://www.jfoenix.com ). 我正在尝试更改在JFoenix的库( http://www.jfoenix.com )上找到的进度条的颜色。 I'm using Java and JavaFX, here is my sample css: 我正在使用Java和JavaFX,这是我的示例CSS:

.progress-bar {
-fx-accent: #4059a9;}

It should work, but instead it disables the color. 它应该可以工作,但是会禁用颜色。

With css enabled: 启用CSS:

在此处输入图片说明

With css disabled (default color showing): 在禁用CSS的情况下(显示默认颜色):

在此处输入图片说明

It seems that your problem is caused by the background insets. 看来您的问题是由背景插图引起的。

Add this to your stylesheet: 将此添加到您的样式表:

.jfx-progress-bar > .track, .jfx-progress-bar > .bar {
    -fx-background-radius: 0;
    -fx-background-insets: 0;
}

Now the styling works: 现在的样式工作:

.jfx-progress-bar > .bar {
    -fx-background-color: red;
}

The background color may be messed up after doing this, you can fix it with this: 完成此操作后,背景颜色可能会混乱,您可以使用以下方法进行修复:

.jfx-progress-bar > .track {
    -fx-background-color: #E0E0E0;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM