简体   繁体   中英

How to set margin to Image control spark

<s:Image id="loader1" top="50" source="@Embed(source='logo.png')"/>

top属性不起作用,如何对图像进行边距处理?

Since your image is inside a VBox and you want only to pad the Image and not the other components, here are some options:

  • Put the Image inside a Group : the VBox wil layout the Group vertically and the Image will be positioned 50px from the top of the Group
  • Put a Spacer between the Image and the component before it and give it a height of 50px.
  • If the Image is the first element, you can set paddingTop="50" on the VBox.

Side note: you'd better use s:VGroup instead of mx:VBox since you seem to already use Spark components: it has better performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM