答案 0 :(得分:1)
这两个选择器应该为ListView
s:
.list-cell:filled:selected {
-fx-background: orange;
}
.list-view:focused > .virtual-flow > .clipped-container > .sheet > .list-cell:filled:selected {
-fx-background: -fx-selection-bar;
}
要在TableView
s(单元格和行选择)中使用相同的着色,您可以添加更多选择器:
.table-row-cell:filled:selected,
.tree-table-row-cell:filled:selected,
.table-row-cell:filled > .table-cell:selected,
.tree-table-row-cell:filled > .tree-table-cell:selected,
.list-cell:filled:selected {
-fx-background: orange;
}
.table-view:focused > .virtual-flow > .clipped-container > .sheet > .table-row-cell:filled:selected,
.tree-table-view:focused > .virtual-flow > .clipped-container > .sheet > .tree-table-row-cell:filled:selected,
.table-view:focused > .virtual-flow > .clipped-container > .sheet > .table-row-cell .table-cell:selected,
.tree-table-view:focused > .virtual-flow > .clipped-container > .sheet > .tree-table-row-cell .tree-table-cell:selected ,
.list-view:focused > .virtual-flow > .clipped-container > .sheet > .list-cell:filled:selected {
-fx-background: -fx-selection-bar;
}
注意:这些选择器甚至定位TreeTableViews
。
结果: