Apache flex 弹性体3:“;“是”;对图像没有任何影响

Apache flex 弹性体3:“;“是”;对图像没有任何影响,apache-flex,flex3,coordinates,Apache Flex,Flex3,Coordinates,在我的一个孩子身上,我有以下代码: <mx:Canvas id="projWrapper" x="{parentApplication.oneDay * startOffset}" width="{parentApplication.oneDay * numDays}" height="26" backgroundColor="{conflictBG}" borderColor="#000000" borderSides="bottom top left right" borderStyl

在我的一个孩子身上,我有以下代码:

<mx:Canvas id="projWrapper" x="{parentApplication.oneDay * startOffset}" width="{parentApplication.oneDay * numDays}" height="26" backgroundColor="{conflictBG}" borderColor="#000000" borderSides="bottom top left right" borderStyle="solid" borderThickness="1">
    <mx:HBox verticalGap="0">
        <mx:Image id="expandBlockLeft" source="images/addRed.png" y="5" />
        <mx:Text id="sNameShow" text="{sName}" />
    </mx:HBox>
</mx:Canvas>

图像是一个小加号(“+”),从画布的坐标0开始。我需要它在0点,5点开始。。。但是,无论我将y值更改为什么,加号都不会移动

我知道这看起来很简单,我相信是的,但我一辈子都搞不懂

如果有人能对我的小问题有所了解,我们将不胜感激。

尝试使用:

<mx:Canvas id="projWrapper" x="{parentApplication.oneDay * startOffset}" width="{parentApplication.oneDay * numDays}" height="26" backgroundColor="{conflictBG}" borderColor="#000000" borderSides="bottom top left right" borderStyle="solid" borderThickness="1">
    <mx:HBox verticalGap="0" paddingTop="5">
        <mx:Image id="expandBlockLeft" source="images/addRed.png" />
        <mx:Text id="sNameShow" text="{sName}" />
    </mx:HBox>
</mx:Canvas>


问题是,
HBox
布局容器不支持使用
x
y
自定义精确定位以及定位本身的响应(按设计)。您可以使用间隙、填充和对齐来进行一些自定义调整,或者使用具有绝对定位的容器,如
画布

,但这不也会移动文本元素吗?文本显示在我需要的地方,而不是图像。我可能只是移除HBox,然后手动放置东西。谢谢你的信息!如果确实需要动态布局,但希望在不更改填充的情况下向下移动图像,则可以在图像周围创建vbox,并在图像上方添加5px“”。如果只想将图像向下移动5px,则可以将其包装到新框中并使其成为框。paddingTop=5