简体   繁体   English

如何为图像控制火花设置边距

[英]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: 由于您的图像位于VBox并且您只希望填充图像而不是其他组件,因此有一些选择:

  • 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 将图像放入Group :VBox将垂直排列组,并且图像将距组顶部50px
  • Put a Spacer between the Image and the component before it and give it a height of 50px. 在图像和组件之间放置一个Spacer ,并使其高度为50px。
  • If the Image is the first element, you can set paddingTop="50" on the VBox. 如果Image是第一个元素,则可以在VBox上设置paddingTop="50"

Side note: you'd better use s:VGroup instead of mx:VBox since you seem to already use Spark components: it has better performance. 旁注:最好使用s:VGroup而不是mx:VBox因为您似乎已经在使用Spark组件:它具有更好的性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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