2
我在StackPane中调整了ImageView的大小: 如果StackPane是根容器,并且将图像的高度和宽度绑定到StackPane,一切都很好。在StackPane中调整JavaFX ImageView的大小
<StackPane id="StackPane" fx:id="stack" prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: lightgreen;" styleClass="mainFxmlClass" xmlns:fx="http://javafx.com/fxml" fx:controller="javafxapplication8.FXMLController">
<children>
<ImageView fx:id="image" fitHeight="100.0" fitWidth="300.0" pickOnBounds="true" preserveRatio="true" />
</children>
<stylesheets>
<URL value="@fxml.css" />
</stylesheets>
</StackPane>
但是,如果我放置这样的堆栈窗格,例如网格,比图像不适当调整大小。 当我阅读时,ImageView是不可调整大小的问题。有什么方法可以调整大小吗?或者你可以给一些建议如何调整ImageView的大小?
非常感谢!)我想创建背景图片或视频,你的链接帮了我很多。适合我的解决方法是包含MediaView或ImageView的可调整大小的窗格。 –