【发布时间】:2020-05-20 11:47:39
【问题描述】:
我有一个带有图标和文本的按钮,但我不知道如何将图标放置在中间,文本放置在按钮的左下方。这就是它现在的样子:
<Button text="Text" GridPane.rowIndex="0" GridPane.columnIndex="2" prefWidth="135" prefHeight="110" style="-fx-background-color: rgb(176,30,0); -fx-text-fill: rgb(255,255,255); -fx-alignment: BOTTOM_LEFT;">
<graphic>
<ImageView>
<Image url="file:///....png"/>
</ImageView>
</graphic>
</Button>
我尝试了两件事,但没有奏效: 1. 给 ImageView 一个单独的对齐属性。 2. 在按钮和imageView中放置一个VXbox,并在VBox中放置带有文本的标签。
提前致谢!
【问题讨论】: