JavaFX - 如何删除 ListView 和 TableView 的条带?
JavaFX - How to remove ListView & TableView's bands?
我正在以默认样式将 JavaFX ListViews 和 TableViews 添加到我的应用程序。
奇数行背景为白色,偶数行背景为灰色。
我不喜欢那些乐队,尤其是在无人居住的行上。
我用 fxid:list_PayMethod 在我的 ListView 上尝试了以下 CSS 设置,但没有帮助。
(此页面无法将 fxid 识别为代码的一部分,因此它不在灰色框内,请注意。)
#list_PayMethod {
.list-cell:odd {
-fx-padding: 0px;
-fx-control-background: #F4F4F4;
-fx-control-inner-background: #F4F4F4;
}
.list-cell:even {
-fx-padding: 0px;
-fx-control-background: #F4F4F4;
-fx-control-inner-background: #F4F4F4;
}
.list-view:focused .list-cell:focused:odd {
-fx-padding: 0px;
-fx-control-background: #F4F4F4;
-fx-control-inner-background: #F4F4F4;
}
.list-view:focused .list-cell:focused:even {
-fx-padding: 0px;
-fx-control-background: #F4F4F4;
-fx-control-inner-background: #F4F4F4;
}
}
有什么办法可以设置全写还是全灰?
谢谢!
将 -fx-control-background
替换为 -fx-background-color
就足够了。
.list-cell {
-fx-background-color: #F4F4F4;
}
我正在以默认样式将 JavaFX ListViews 和 TableViews 添加到我的应用程序。
奇数行背景为白色,偶数行背景为灰色。 我不喜欢那些乐队,尤其是在无人居住的行上。
我用 fxid:list_PayMethod 在我的 ListView 上尝试了以下 CSS 设置,但没有帮助。
(此页面无法将 fxid 识别为代码的一部分,因此它不在灰色框内,请注意。)
#list_PayMethod {
.list-cell:odd {
-fx-padding: 0px;
-fx-control-background: #F4F4F4;
-fx-control-inner-background: #F4F4F4;
}
.list-cell:even {
-fx-padding: 0px;
-fx-control-background: #F4F4F4;
-fx-control-inner-background: #F4F4F4;
}
.list-view:focused .list-cell:focused:odd {
-fx-padding: 0px;
-fx-control-background: #F4F4F4;
-fx-control-inner-background: #F4F4F4;
}
.list-view:focused .list-cell:focused:even {
-fx-padding: 0px;
-fx-control-background: #F4F4F4;
-fx-control-inner-background: #F4F4F4;
}
}
有什么办法可以设置全写还是全灰?
谢谢!
将 -fx-control-background
替换为 -fx-background-color
就足够了。
.list-cell {
-fx-background-color: #F4F4F4;
}