Flex Spark:如何右键对齐按钮或tabbar按钮上的图标?

Dav*_*rer 2 apache-flex alignment flex4

我想右键对齐按钮或tabbarbutton上的图标,并保持文本在Flex 4.0 Spark中保持对齐.

到目前为止,我在自定义皮肤中提出了以下内容:

<s:HGroup>
    <s:HGroup horizontalAlign="left">
        <s:Label id="labelDisplay"
                 textAlign="left"
                 maxDisplayedLines="1"
                 top="10">
        </s:Label>
    </s:HGroup>

    <s:HGroup horizontalAlign="right" bottom="5" right="0">
        <s:BitmapImage source="@Embed('assets/images/icons/close.png')" />
    </s:HGroup>
</s:HGroup>
Run Code Online (Sandbox Code Playgroud)

但是让一个拥有2个HGroup子集的HGroup只是为了让horizo​​ntalAlign向右移动似乎很愚蠢.

谁知道更好的方法?

Thx,=戴夫

Wad*_*ler 5

您可以将标签的宽度设置为100%.

<s:HGroup>
    <s:Label id="labelDisplay" width="100%"/>
    <s:BitmapImage source="@Embed('assets/images/icons/close.png')" />
</s:HGroup>
Run Code Online (Sandbox Code Playgroud)

如果你的按钮都是明确的宽度,你也可以尝试这样的事情:

<s:HGroup>
    <s:Label id="labelDisplay"/>
    <mx:Spacer width="100%"/>
    <s:BitmapImage source="@Embed('assets/images/icons/close.png')" />
</s:HGroup>
Run Code Online (Sandbox Code Playgroud)