Flex中VGroup内的中心标签实例

Fly*_*Cat 3 center alignment flex4

我试图将我的标签置于我的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>
Run Code Online (Sandbox Code Playgroud)

小智 6

试试这个,

<s:Label text="test1" width="100%" textAlign="center" />
Run Code Online (Sandbox Code Playgroud)

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