开发者

Flex Spark: How to right align an icon on a button or tabbar button?

I would like to right align an icon on a button or tabbarbutton and keep the text left aligned in Flex 4.0 Spark.

So far, I've come up with something like the following in my custom skin:

<s:HGroup>
    <s:HGroup horizontalAlign="left">
        <s:Label id="labelDisplay"
                 textAlign="left"
                 maxDisplayedLines="1"
                 top="10">
        </s:Label&g开发者_StackOverflow社区t;
    </s:HGroup>

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

But it seems silly to have an HGroup with 2 HGroup children just to get the horizontalAlign to the right.

Anyone know of a better way?

Thx, =Dave


You could set the width of the label to be 100%.

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

If your buttons are all an explicit width, you could also try something like this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜