将Spark TabBar放在ViewStacks的底部(+圆角指向下方)

时间:2010-11-22 01:32:09

标签: actionscript-3 flex4 tabbar

<s:VGroup horizontalAlign="center" horizontalCenter="0" verticalCenter="0" gap="0">
    <mx:ViewStack id="view" width="450" height="300" />
    <!-- NavigatorContent dynamically gets added to view on appComplete-->
    <s:TabBar dataProvider="{view}" skinClass="skins.CustomSparkTabBarSkin" />
</s:VGroup>

自定义皮肤:

<s:Skin 
xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:fb="http://ns.adobe.com/flashbuilder/2009"     
alpha.disabled="0.5"><fx:Metadata>
    <![CDATA[ 
    [HostComponent("spark.components.TabBar")]
    ]]>
</fx:Metadata> 

<fx:Script  fb:purpose="styling" >
    <![CDATA[ 

    import mx.core.UIComponent;

    /**  Push the cornerRadius style to the item renderers.*/
    override protected function updateDisplayList(unscaledWidth:Number, unscaleHeight:Number):void {
        const numElements:int = dataGroup.numElements;
        const cornerRadius:int = hostComponent.getStyle("cornerRadius");

        for (var i:int = 0; i < numElements; i++) {
            var elt:UIComponent = dataGroup.getElementAt(i) as UIComponent;
            if (elt)
                elt.setStyle("cornerRadius", cornerRadius);
        }
        super.updateDisplayList(unscaledWidth, unscaledHeight);
    }

    ]]>            
</fx:Script>
<s:states>
    <s:State name="normal" />
    <s:State name="disabled" />
</s:states>
<!--- @copy spark.components.SkinnableDataContainer#dataGroup -->
<s:DataGroup id="dataGroup" width="100%" height="100%">

                     
                                                           

出现类似的事情:http://yozef.com/files/tabExample.png

我想把TabBar放在视图堆的底部,圆角指向外面。

1 个答案:

答案 0 :(得分:0)

从头开始...在设计模式下... 单击Outline视图中的TabBar,在属性视图中单击Skin旁边的下拉菜单,然后选择Create Skin ...切换到源视图并找到ButtonBarButton并向其添加rotation =“180”...(这几乎是你想要什么,但文本将颠倒)返回设计视图(在你的TabBar自定义皮肤上)并单击大纲视图中的ButtonBarButton,在属性视图中单击皮肤旁边的下拉菜单,然后选择创建皮肤...在Outline视图中找到labelDisplay并添加rotation =“180”

这是我能想到达到你想要的最快的方式,你可能会发现你想在自定义ButtonBarButton皮肤中调整其他值,如果文本不是你想要的那么。