我尝试在方向为水平时将厚度设置为-fx-pref-height: 10px;
,当滚动条方向为垂直时,我尝试将其设置为-fx-pref-width: 10px;
。但是不行。如何通过CSS自定义javafx滚动条的拇指厚度?
.scroll-bar:horizontal .thumb {
-fx-background-color: derive(black, 90%);
-fx-background-insets: 2, 0, 0;
-fx-background-radius: 0em;
-fx-pref-height: 10px;
}
.scroll-bar:vertical .thumb {
-fx-background-color: derive(black, 90%);
-fx-background-insets: 2, 0, 0;
-fx-background-radius: 0em;
-fx-pref-width: 10px;
}
如何通过自定义css来实现这一点?
逻辑。为什么是16.5? – Vanguard
你可以测试你喜欢的任何值。我编辑了我的答案并添加了@anlar的答案。箭头大小与字体大小绑定。 – Pakbert