2 回答

TA貢獻1807條經驗 獲得超9個贊
問題不是 的屬性/布局約束,而是不允許增長到比首選寬度 ( ) 更寬MenuButton的事實。HBox346.0
將 的值更改maxWidth為USE_COMPUTED_SIZE(= -1)?;蛘撸恍鑼傩詣h除為恰好為的默認值USE_COMPUTED_SIZE。
這允許HBox增長到SplitPane防止較小尺寸HBox水平居中的尺寸。
<SplitPane dividerPositions="0.5" orientation="VERTICAL" prefHeight="200.0" prefWidth="342.0" AnchorPane.bottomAnchor="363.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<HBox maxHeight="-Infinity" prefHeight="46.0" prefWidth="346.0"> <!-- removed maxWidth here -->
<children>
<MenuButton alignment="TOP_LEFT" mnemonicParsing="false" prefHeight="46.0" prefWidth="56.0" HBox.hgrow="ALWAYS">
...
</MenuButton>
</children>
</HBox>
...
</items>
</SplitPane>

TA貢獻1860條經驗 獲得超9個贊
我已閱讀您的問題并希望您查找 MenuButton 的對齊屬性?;蛘吣梢允褂眠吙虼案褚运姆N方式對齊您的組件。
1) 頂部,2) 底部,3) 左側,4) 右側
添加回答
舉報