2012-05-04 132 views
0

我在頁面上排列了以下4個標籤。動態更改標籤的寬度

<s:Label id="lblName" x="10" y="13" text="{data.name}"/> 
    <s:Label id="lblComputer" x="10" y="37.5" text="{data.computer}"/> 
    <s:Label id="lblModel" x="45" y="37.5" text="{data.model}"/> 
    <s:Label id="lblCPU" x="43" y="63" text="{data.cpu}"/> 

我試圖讓佈局看起來像這樣:

lblName

lblComputer lblModel

lblCPU

它的工作原理,如果lblComputer是短暫的名稱,但是如果它有很多字符,那麼lblComputer和lblModel一起運行並且完全不可讀。

如果lblComputer碰巧真的很長,有沒有辦法將lblModel的x值動態地改變爲lblComputer的「騰出空間」?

感謝

回答

3

你可以把他們在VGroup和HGroup和刪除X,Y彎曲會處理的定位;

<s:VGroup> 
    <s:Label id="lblName" text="{data.name}"/> 
    <s:HGroup> 
     <s:Label id="lblComputer" text="{data.computer}"/> 
     <s:Label id="lblModel" text="{data.model}"/> 
    </s:HGroup> 
    <s:Label id="lblCPU" text="{data.cpu}"/> 
</s:VGroup> 
+0

完美!謝謝! – SkyeBoniwell