<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 放置在视图堆栈的底部,圆角朝外。