Flex 4.5 TabNavigator cornerRadius无法正常工作

时间:2011-10-19 15:50:18

标签: flex tabnavigator cornerradius

我最难找到一种方法来简单地将圆形标签添加到TabNavigator控件。

我见过的示例看起来非常简单,但它们似乎在Flex 4.5中不起作用。以下是一些示例代码:

<?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">
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Style source="style.css"/>

<mx:TabNavigator x="93" y="90" width="571" height="293" tabStyleName="tabstyle">
    <s:NavigatorContent width="100%" height="100%" label="Tab 1">
    </s:NavigatorContent>
</mx:TabNavigator>
</s:Application>

和css:

/* CSS file */
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";

.tabstyle
{
corner-radius: 10;
}

我也尝试过cornerRadius:10;

为什么这不起作用的任何想法?任何易于遵循的解决方案(我是初学者)。

感谢。

4 个答案:

答案 0 :(得分:0)

您可以为应用程序/选项卡导航器创建外观,使用Flash Builder中的“创建副本”选项,并在“矩形”部分中设置radiusX,radiusY值。然后将该皮肤用于组件

答案 1 :(得分:0)

这是我对此问题所知的最佳和最简单的解决方法。似乎Adobe从未解决过这个错误。

<s:VGroup width="100%" height="100%" gap="0" >
    <s:Group width="100%">
        <s:TabBar left="4" dataProvider="{tabNav}" cornerRadius="4" />
    </s:Group>
    <s:BorderContainer width="100%" height="100%" cornerRadius="4">
        <mx:ViewStack id="tabNav" paddingBottom="10" width="100%" height="100%" >
            <s:NavigatorContent label="Form" width="100%" height="100%">
                ...
            </s:NavigatorContent>
            <mx:Canvas id="treeNode" label="TreeNodeComponent" width="100%" height="100%">
                ...
            </mx:Canvas>
            <mx:Canvas id="melding" label="Melding" width="100%" height="100%" visible="{authorisation.moduleHasUserAutorization('melding')}" includeInLayout="{melding.visible}">
                ...
            </mx:Canvas>
        </mx:ViewStack>
    </s:BorderContainer>
</s:VGroup>

它相当于此,但在标签(和正文)中有圆角:

<mx:TabNavigator id="tabNav" paddingBottom="10" width="100%" height="100%" >
    <s:NavigatorContent label="Form" width="100%" height="100%">
        ...
    </s:NavigatorContent>
    <mx:Canvas id="treeNode" label="TreeNodeComponent" width="100%" height="100%">
        ...
    </mx:Canvas>
    <mx:Canvas id="melding" label="Melding" width="100%" height="100%" visible="{authorisation.moduleHasUserAutorization('melding')}" includeInLayout="{melding.visible}">
        ...
    </mx:Canvas>
</mx:TabNavigator>

答案 2 :(得分:-1)

试试这个!

<mx:TabNavigator id="tabNavigator" tabOffset="20" cornerRadius="10" height="100%" width="100%">

答案 3 :(得分:-1)

这是您可以复制和运行的示例代码

        <s:NavigatorContent id="search" label="Search"  width="100%" height="100%" fontWeight="bold" 
                            >

            <s:layout>

                <s:VerticalLayout horizontalAlign="center"  
                                  paddingTop="5" paddingLeft="5" 
                                  paddingRight="5" paddingBottom="5" />
            </s:layout>

            <s:Label text="Search Panel" />
            <s:HGroup >
                <s:TextInput id="Searchtxt" width="200" />
                <mx:Button label="search" click="Searchtxt.text=''" />
            </s:HGroup>
        </s:NavigatorContent>

        <s:NavigatorContent id="custInfo" label="Customer Info" backgroundColor="0xDCDCDC" 
                            width="100%" height="100%" fontWeight="bold" >

            <s:layout>
                <s:VerticalLayout horizontalAlign="center"  
                                  paddingTop="5" paddingLeft="5" 
                                  paddingRight="5" paddingBottom="5" />
            </s:layout>

            <s:Label text="Customer Info" />
            <s:HGroup>
                <s:Label text="Email Address"/>
                <s:TextInput id="email" width="200"/>
                <s:Button label="Submit" click="email.text='';" />
            </s:HGroup>
        </s:NavigatorContent>

        <s:NavigatorContent id="accountInfo" label="Account Info" backgroundColor="0xDCDCDC" width="100%" height="100%" fontWeight="bold" >

            <s:layout>
                <s:VerticalLayout horizontalAlign="center"  
                                  paddingTop="5" paddingLeft="5" 
                                  paddingRight="5" paddingBottom="5" />
            </s:layout>

            <s:Label text="Account Info" />
            <s:HGroup>
                <s:Button label="Purchases" />
                <s:Button label="Sales" />
                <s:Button label="Reports" />
            </s:HGroup>
        </s:NavigatorContent>

    </mx:ViewStack>