簡體   English   中英

如何設置 ImageView 的邊距和填充?

[英]How to set the margin and padding of an ImageView?

如何設置<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>

查看ImageView的屬性列表 沒有這樣的財產或任何財產可以讓您達到類似的效果。 或許可以使用父布局的布局參數來實現效果; 如果這是不可能的; 您需要將ImageView包裝在允許這樣做的布局中,例如:

<StackPane maxHeight="-Infinity" maxWidth="-Infinity"> <!-- use the preferred size for max size constraints -->
    <padding>
        <Insets topRightBottomLeft="50" />
    </padding>
    <children>
        <ImageView fitHeight="120" fitWidth="120" fx:id="image" onMousePressed="#mousePressed"/>
    </children>
</StackPane>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM