PopupView 始终显示白色矩形作为背景
PopupView always shows a white rectangle as background
.popup-view {
-fx-background-color: red; // nothing happens here
}
.popup-view .scroll-pane {
-fx-background-color: green; // nothing happens here
}
.popup-view .viewport {
-fx-background-color: violet; // color is shown
-fx-border-color: violet;
-fx-background-radius: 7; // no affect
-fx-border-radius: 7;
}
如果我删除 .viewport,它只会显示没有半径的白色背景。
我想要一个具有特定颜色和半径的弹出视图
那个背景-例如紫罗兰色。感谢您的帮助!
如果您使用 ScenicView 检查 PopupView
控件,您会看到它的 ScrollPane
具有 class root-node
.
所以你的 css 应该是这样的:
.popup-view > .root-node {
-fx-background-color: green;
}
.popup-view > .root-node > .viewport {
-fx-background-color: violet;
-fx-border-color: violet;
-fx-background-radius: 7;
-fx-border-radius: 7;
}
.popup-view {
-fx-background-color: red; // nothing happens here
}
.popup-view .scroll-pane {
-fx-background-color: green; // nothing happens here
}
.popup-view .viewport {
-fx-background-color: violet; // color is shown
-fx-border-color: violet;
-fx-background-radius: 7; // no affect
-fx-border-radius: 7;
}
如果我删除 .viewport,它只会显示没有半径的白色背景。
我想要一个具有特定颜色和半径的弹出视图 那个背景-例如紫罗兰色。感谢您的帮助!
如果您使用 ScenicView 检查 PopupView
控件,您会看到它的 ScrollPane
具有 class root-node
.
所以你的 css 应该是这样的:
.popup-view > .root-node {
-fx-background-color: green;
}
.popup-view > .root-node > .viewport {
-fx-background-color: violet;
-fx-border-color: violet;
-fx-background-radius: 7;
-fx-border-radius: 7;
}