我有一个驻留有FlowPane的ScrollPane。当我通过拖动边缘来调整窗口大小时,FlowPane不会增长!它保持其固定的大小。当鼠标展开FlowPane时,如何调整ScrollPane的大小?
我试过很多方法,但是没有成功!下面是我的fxml代码的最简单形式:
<ScrollPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/11.0.1">
<content>
<FlowPane prefHeight="411.0" prefWidth="613.0" style="-fx-background-color: green;" />
</content>
</ScrollPane>发布于 2019-06-04 13:47:08
答案很简单。但是不知道为什么没有人回答。经过几个小时的测试,我找到了解决方案。如果其他人也有同样的问题,我会分享答案。
<ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="ALWAYS" prefHeight="670.0" prefWidth="434.0" vbarPolicy="ALWAYS" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="6.0" AnchorPane.topAnchor="0.0">https://stackoverflow.com/questions/56437257
复制相似问题