我需要做一组切换按钮,如下所示,白色背景是选中的按钮,两个按钮占父容器宽度的50%。在HBox中放置了两个切换按钮。样式设置
?
?
到目前为止,我试过了,就像这样。
?
?
.viewType .toggle-button {
-fx-padding: 0 2 0 2;
-fx-background-color: #000;
-fx-text-fill: white;
}
.viewType .toggle-button:selected {
-fx-padding: 0;
-fx-background-color: white;
-fx-text-fill: black;
-fx-border-wdith: 2;
-fx-border-color: black;
-fx-border-radius: 4;
}
转载请注明出处:http://www.songfuwangmfj.com/article/20230526/1972500.html