2011-11-27 47 views
0

請問有誰知道,如何使List和Checkbox(在VGroup內)適合TileWindowVGroup或列表不適合TileWindow,太高

screenshot

的完整源代碼Text.mxml

<?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"> 

    <s:TitleWindow width="240" height="240" 
        title="Why is List so tall?"> 
     <s:VGroup paddingLeft="20" paddingTop="20" 
        paddingRight="20" gap="20" 
        width="100%" height="100%"> 

      <s:List> 
       <s:ArrayList> 
        <fx:String>10♠</fx:String> 
        <fx:String>Д♠</fx:String> 
        <fx:String>К♠</fx:String> 
        <fx:String>10♠</fx:String> 
        <fx:String>Д♠</fx:String> 
        <fx:String>К♠</fx:String> 
        <fx:String>10♠</fx:String> 
        <fx:String>Д♠</fx:String> 
        <fx:String>К♠</fx:String> 
       </s:ArrayList> 
      </s:List> 

      <s:CheckBox label="Confirm bid" /> 

     </s:VGroup> 
    </s:TitleWindow> 
</s:Application> 

回答

1

而不指定尺寸時,列表是測量和調整大小本身。

添加寬度和高度名單:

 <s:List width="100%" 
       height="100%"> 

主要生產:

enter image description here

全碼:

<?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"> 

    <s:TitleWindow width="240" 
        height="240" 
        title="Why is List so tall?"> 
     <s:VGroup paddingLeft="20" 
        paddingTop="20" 
        paddingRight="20" 
        gap="20" 
        width="100%" 
        height="100%"> 

      <s:List width="100%" 
        height="100%"> 
       <s:ArrayList> 
        <fx:String>10♠</fx:String> 
        <fx:String>Д♠</fx:String> 
        <fx:String>К♠</fx:String> 
        <fx:String>10♠</fx:String> 
        <fx:String>Д♠</fx:String> 
        <fx:String>К♠</fx:String> 
        <fx:String>10♠</fx:String> 
        <fx:String>Д♠</fx:String> 
        <fx:String>К♠</fx:String> 
       </s:ArrayList> 
      </s:List> 

      <s:CheckBox label="Confirm bid" /> 

     </s:VGroup> 
    </s:TitleWindow> 
</s:Application> 
+0

謝謝,但爲什麼HEIGHT = 「100%」 ?這是否爲下面的複選框留下了任何地方? –

+1

爲列表指定一個明確的高度,或將CheckBox和List分組到一個容器中,或者指定頂部左上角的底部,並允許使用常規Group在底部屬性上使用CheckBox高度。 VGroup中元素的垂直佈局可能取決於您是否希望它們的距離爲20。 –