2010-11-22 55 views
0
<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> 

自定義皮膚:地點火花的TabBar(+圓角朝下)

<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放在視圖堆的底部,圓角指向外部。

+0

如果我將旋轉=「180」添加到TabBar 's:TabBar dataProvider =「{view}」skinClass =「skins.CustomSparkTabBarSkin」旋轉=「180」/>' 將使事情變得更加可笑。 我不明白爲什麼使用底部按鈕創建TabNavigator非常困難?! – Yozef 2010-11-22 01:55:44

回答

0

從頭開始...在設計模式下... 單擊大綱視圖中的TabBar,在屬性視圖中單擊外觀旁邊的下拉列表並選擇創建外觀...切換到源視圖並查找ButtonBarButton並將旋轉=「180」添加到它...(這幾乎是你想要的,但文本將顛倒)返回到設計視圖(在TabBar自定義皮膚上),然後在大綱視圖中單擊ButtonBarButton,然後在屬性視圖中單擊皮膚旁邊的下拉菜單並選擇創建皮膚...在大綱視圖中查找標籤顯示並添加旋轉=「180」

這是我能想到的最快的方法,重新尋找,你可能會發現你想調整自定義的ButtonBarButton皮膚中的其他值如果文本不完全在你想要的位置...

+0

這是一個黑客...現在我有兩個角落圓...還想象索引瀏覽器...索引總是錯的:S – Yozef 2010-11-22 15:44:03