我正在尝试向选定的表格行添加红色边框,并且该行中的元素正在移动。
这是我的CSS:
.my-table .table-row-cell:filled:selected {
-fx-border-color: red;
}
Run Code Online (Sandbox Code Playgroud)
这是其外观的屏幕截图。
我该如何纠正?我尝试过更改边框插图,但似乎没有效果。
-fx-background-insets: 0, 1 ;
Run Code Online (Sandbox Code Playgroud)
用于创建表的代码是:
<TableView styleClass="my-table" editable="false" >
<columns>
<TableColumn fx:id="columnNumber" minWidth="70" prefWidth="70" sortable="false" text="Solution" />
<TableColumn fx:id="columnOne" minWidth="0" prefWidth="40" sortable="false" text="columnOne" />
<TableColumn fx:id="columnTwo" minWidth="40" prefWidth="40" sortable="false" text="columnTwo" />
<TableColumn fx:id="columnThree" minWidth="70" prefWidth="70" sortable="false" text="columnThree" />
<TableColumn fx:id="columnFour" minWidth="40" prefWidth="40" sortable="false" text="columnFour" />
<TableColumn fx:id="columnFive" minWidth="80" prefWidth="80" sortable="false" text="columnFive" />
<TableColumn fx:id="columnSix" minWidth="80" prefWidth="80" sortable="false" text="columnSix" />
<TableColumn fx:id="columnSeven" minWidth="80" prefWidth="80" sortable="false" text="columnSeven" />
<TableColumn fx:id="columnEight" minWidth="180" prefWidth="180" sortable="false" text="columnEight" />
<TableColumn fx:id="action" minWidth="100" prefWidth="100" sortable="false" text="" />
</columns>
</TableView>
Run Code Online (Sandbox Code Playgroud)
应用的样式为:
.table-view {
-fx-table-cell-border-color: transparent;
}
Run Code Online (Sandbox Code Playgroud)
小智 6
她是一个肮脏的修复:
.my-table .table-row-cell:filled:selected {
-fx-border-color: red;
-fx-border-insets: 0 -1 0 -1;
}
Run Code Online (Sandbox Code Playgroud)
或者
.my-table .table-row-cell:filled:selected {
-fx-border-color: red;
-fx-padding: -1;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
433 次 |
| 最近记录: |