一段时间以来,我一直在尝试使用 CSS 来设置滚动条的样式。在一些帮助下,我设法到达某个地方,但下面的这个小白框不想消失。你如何摆脱它? "/image/ZGKPb.png "
我的CSS代码
.mylistview{
-fx-background-color:"#34495e";
}
/* The main scrollbar CSS class of ListView */
.mylistview .scroll-bar:horizontal ,
.mylistview .scroll-bar:vertical{
-fx-background-color:"#34495e";
}
/* The increment and decrement button CSS class of scrollbar */
.mylistview .increment-button ,.mylistview .decrement-button {
-fx-opacity: 0;
-fx-background-color:"#34495e";
}
.mylistview .decrement-button {
-fx-opacity: 0;
-fx-background-color:"#34495e";
}
/* The main scrollbar **track** CSS class */
.mylistview .scroll-bar:horizontal .track ,
.mylistview .scroll-bar:vertical .track{
-fx-background-color: "#34495e";
}
.mylistview .scroll-bar:horizontal .thumb,
.mylistview .scroll-bar:vertical .thumb {
-fx-background-color:"#2c3e50";
-fx-background-radius: 10em;
}
我的 Fxml 代码
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.ScrollPane?>
<GridPane fx:controller="sample.Controller"
xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10"
stylesheets="/main.css">
<Label fx:id="studentlist">Student List</Label>
<ScrollPane styleClass="mylistview">
<VBox fx:id="box">
<children>
<Label>Michael</Label>
<Label>George</Label>
</children>
</VBox>
</ScrollPane>
</GridPane>
最佳答案
我一直在寻找。它被称为 Angular 。
http://www.guigarage.com/2015/11/styling-a-javafx-scrollbar/
关于Java - FXML,CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47438099/