0

我有一个带有 Cell Factory 的 LisView。单元格工厂根据每行的一些标志(黑色、红色、绿色、蓝色等)更改文本颜色

当我选择一行时,我想将文本的颜色更改为始终为白色,而不管文本的原始颜色如何。这是因为某些文本颜色(例如 red 和 blue )在默认的 -fx-selection-bar 颜色下看起来不太好。

我将以下 CSS 片段添加到我的列表视图中。

.list-view:focused .list-cell:filled:focused:selected 
{
-fx-background-color: -fx-focus-color, -fx-cell-focus-inner-border, -fx-selection-bar;
-fx-background-insets: 0, 1, 2;
-fx-background: -fx-accent;
-fx-text-fill: white;
}

It works fine, but it doesn't return the text to it's original color when the selection is changed from one row to another.

有没有合适的方法来做到这一点?

谢谢。

4

0 回答 0