VGroup或List不适合TileWindow,太高了

时间:2011-11-27 17:36:25

标签: list flex flex4 flex4.5

有人知道,如何使列表和复选框(在VGroup内)适合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 个答案:

答案 0 :(得分:1)

在不指定大小的情况下,List正在测量并调整其大小。

为列表添加宽度和高度:

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