Jafafx listview设置背景色

Jafafx listview设置背景色,listview,javafx,Listview,Javafx,如何更改listview的背景色? 我已经通过css将单元格颜色设置为透明,但我没有设法更改ListView的颜色 这是我的css .messages-listview { // -fx-background-image: url("/images/9.jpg"); this works -fx-background-color: black; /* this doesnt*/ } .messages-listview .list-cell { -fx-background-color: t

如何更改listview的背景色? 我已经通过css将单元格颜色设置为透明,但我没有设法更改ListView的颜色

这是我的css

.messages-listview {
// -fx-background-image: url("/images/9.jpg"); this works

-fx-background-color: black; /* this doesnt*/
}

.messages-listview .list-cell {
-fx-background-color: transparent;
}

我可以设置任何图像作为背景,但我不能设置自定义颜色。有什么想法/建议吗?

您必须像下面这样设置listView的背景

.list-view {
    -fx-background-color: #3c3c3c;
}

您必须设置listView的背景,如下所示:

.list-view {
    -fx-background-color: #3c3c3c;
}

“-fx背景色:黑色;”对我有效。@UlukBiy我发现了问题所在,我不小心更改了css中的默认列表视图,所以一切正常,谢谢)“-fx背景色:黑色;”对我有效。@UlukBiy我发现了问题所在,我不小心更改了css中的默认列表视图,所以一切正常,(谢谢)