我在 JavaFX SceneBuilder 中的布局有问题。
我有一个GridPane
,其中一个单元格包含一个ImageView
内部AnchorPane
,并希望图像调整为锚点。
我试过这个,但它不起作用。仅以全尺寸显示图像。
<AnchorPane fx:id="imageAnchor" GridPane.columnIndex="4" GridPane.rowIndex="1">
<ImageView pickOnBounds="true" fitHeight="${imageAnchor.height}">
<image>
<Image url="https: / /www.mydomain.com/path/image.png" />
</image>
</ImageView>
</AnchorPane>
我也试过
<AnchorPane fx:id="imageAnchor" GridPane.columnIndex="4" GridPane.rowIndex="1">
<ImageView pickOnBounds="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<image>
<Image url="https: / /www.mydomain.com/path/image.png" />
</image>
</ImageView>
</AnchorPane>
...但两者都不起作用。任何想法可能是什么问题?
我想通过 SceneBuilder / XML 来实现这一点。