Flex / mxml:涉及TabBar的新手布局问题

时间:2012-07-13 21:57:44

标签: actionscript-3 flex mxml

如果您运行以下mxml代码,您会发现TabBar和BorderContainer之间存在差距。如何简单地消除这个差距?我无法解决问题。我在TabBar中输入的内容(例如top =" 10"或y =" 10")没有任何效果。

<?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:VGroup top="10" bottom="20" left="20" right="20">

    <s:Group width="100%">

        <s:HGroup left="0" top="2">
            <s:Label id="titleTextId" text="My Title" fontWeight="bold" fontSize="18"/>
        </s:HGroup>

        <s:HGroup right="0" verticalAlign="middle">
            <s:Button label="Button1" width="65"/>
            <s:Button label="Button2" width="65" />
        </s:HGroup>

    </s:Group> 

    <s:TabBar id="tabs" dataProvider="{vs}"/>

    <mx:ViewStack id="vs" height="100%" width="100%">

        <s:NavigatorContent label="Tab 1"  width="100%" height="100%">
            <s:BorderContainer width="100%" height="100%" borderWeight="1" borderStyle="solid">
                <s:Label left="3" top="5" text="This is my first tab..."/>
            </s:BorderContainer>
        </s:NavigatorContent>
        <s:NavigatorContent label="Tab 2"  width="100%" height="100%">
            <s:BorderContainer width="100%" height="100%" borderWeight="1" borderStyle="solid">
                <s:Label left="3" top="5" text="This is my second tab..."/>
            </s:BorderContainer>
        </s:NavigatorContent>

    </mx:ViewStack>
</s:VGroup> 

1 个答案:

答案 0 :(得分:2)

尝试使用gap属性,这应该这样做!

<s:VGroup top="10" bottom="20" left="20" right="20" gap="0">