Flex中VGroup内的中心标签实例

时间:2010-05-09 02:21:32

标签: alignment flex4 center

我正在尝试将我的标签置于我的VGroup内的图像下方。标签现在左对齐,看起来像Horizo​​ntalAlign不能处理spark组件。任何人都知道如何解决它?

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:VGroup width="800">

        <mx:Image source="images/big/city1.jpg"/>
        <s:Label text="test1" horizontalCenter="0" /> //doesn't work....:(
        <s:Label text="test2" />


    </s:VGroup>

</s:Application>

1 个答案:

答案 0 :(得分:6)

试试这个,

<s:Label text="test1" width="100%" textAlign="center" />

您需要指定Label的宽度才能使其对齐。