在我的一个孩子中,我有以下代码:
<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开始。我需要它从0,5开始...但是,无论我将y值更改为什么,加号都不会移动。
我知道这看起来很简单,我确信它是,但我无法理解我的生活。
如果有人能在这里解释我的小问题,我们将不胜感激。
答案 0 :(得分:2)
尝试使用:
<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
的自定义精确定位以及定位本身的响应(按设计)。您可以使用间隙,填充和对齐来进行一些自定义调整,或使用具有绝对定位的容器,如Canvas
。