如何设置ImageView的边距和填充?

问题描述 投票:0回答:1

如何设置<ImageView>的边距和填充?

我做了fx-padding: 50px;fx-margin: 50px;,但它不起作用。

我的代码:

<ImageView style="fx-padding: 50px; fx-margin: 50px;"
    fitHeight="120" fitWidth="120" fx:id="image" onMousePressed="#mousePressed">
</ImageView>
java javafx fxml javafx-css
1个回答
1
投票

看看property list of ImageView;没有这样的属性或任何可以使您达到类似效果的属性。您可能可以使用父布局的布局参数来实现效果;如果不可能的话;您需要将ImageView包装在允许这样做的布局中,例如:

ImageView
© www.soinside.com 2019 - 2024. All rights reserved.