JavaFX - 如何删除ListView和TableView的波段?



我正在以默认样式将JavaFX ListViews和TableViews添加到我的应用程序中。

奇数行为白色背景,偶数行为灰色背景。 我不喜欢那些乐队,尤其是在无人居住的行上。

我使用 fxid:list_PayMethod 在我的列表视图上尝试了以下 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;
}

最新更新