Flex TabNavigator控件

2018-01-01 18:57 更新

介紹

TabNavigator控件是一個(gè)導(dǎo)航器容器,它具有子容器的集合,但每次只能顯示一個(gè)子容器。

類聲明

以下是 mx.containers.TabNavigator 類的聲明:

public class TabNavigator 
   extends ViewStack 
      implements IFocusManagerComponent

受保護(hù)的屬性

S.N.屬性和描述
1

tabBar:mx.controls:TabBar

對(duì)此TabNavigator中的Tab鍵的引用。

2

tabBarStyleFilters:Object

[只讀]從TabNavigator傳遞到標(biāo)簽欄的一組樣式。

公共方法

S.N.方法和描述
1

TabNavigator()

構(gòu)造函數(shù)。

2

getTabAt(index:int):Button

返回導(dǎo)航器的Tab鍵控件在指定索引處的選項(xiàng)卡。

保護(hù)方法

S.N.方法和描述
1

measure():void

[override]計(jì)算此TabNavigator容器的默認(rèn)大小,最小值和最大值。

2

updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void

[override]通過設(shè)置此容器的選項(xiàng)卡和子項(xiàng)的位置和大小來響應(yīng)大小更改。

繼承的方法

此類繼承以下類中的方法:

  • mx.containers.ViewStack

  • mx.core.Container

  • mx.core.UIComponent

  • mx.core.FlexSprite

  • flash.display.Sprite

  • flash.display.DisplayObjectContainer

  • flash.display.InteractiveObject

  • flash.display.DisplayObject

  • flash.events.EventDispatcher

  • Object

Flex TabNavigator控件示例

讓我們按照以下步驟,通過創(chuàng)建測(cè)試應(yīng)用程序來檢查Flex應(yīng)用程序中TabNavigator控件的使用情況:

步驟描述
1 Flex - 創(chuàng)建應(yīng)用程序章節(jié)中所述,在包 com.tutorialspoint.client 下創(chuàng)建名為 HelloWorld 的項(xiàng)目。
2修改 HelloWorld.mxml ,如下所述。 保持文件的其余部分不變。
3編譯并運(yùn)行應(yīng)用程序,以確保業(yè)務(wù)邏輯按照要求工作。

以下是修改后的mxml文件 src / com.tutorialspoint / HelloWorld.mxml 的內(nèi)容。

<?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"
   width="100%" height="100%" minWidth="500" minHeight="500"
   >
   <fx:Style source="/com/tutorialspoint/client/Style.css"/>	   
   <s:BorderContainer width="630" height="480" id="mainContainer" 
      styleName="container">
      <s:VGroup width="100%" height="100%" gap="50" 
         horizontalAlign="center" verticalAlign="middle">
         <s:Label id="lblHeader" text="Complex Controls Demonstration" 
            fontSize="40" color="0x777777" styleName="heading"/>
            <s:Panel id="tabNavigatorPanel" title="Using TabNavigator" 
               width="500" height="300" >
               <s:layout>
                  <s:HorizontalLayout  gap="10" verticalAlign="middle" 
                     horizontalAlign="center"/>	
               </s:layout>				
               <mx:TabNavigator id="tabNavigator" width="95%" height="90%">
                  <s:NavigatorContent label="Section 1" width="100%" 
                     height="100%">
                     <s:VGroup verticalAlign="middle" horizontalAlign="center" 
                        width="100%" height="100%">
                        <s:Label text="Contents for Section 1"/>	
                     </s:VGroup>							
                  </s:NavigatorContent>
                  <s:NavigatorContent label="Section 2" width="100%" 
                     height="100%">
                     <s:VGroup verticalAlign="middle" horizontalAlign="center"
                        width="100%" height="100%">
                        <s:Label text="Contents for Section 2"/>	
                     </s:VGroup>							
                  </s:NavigatorContent>
                  <s:NavigatorContent label="Section 3" width="100%" 
                     height="100%">
                     <s:VGroup verticalAlign="middle" horizontalAlign="center" 
                        width="100%" height="100%">
                        <s:Label text="Contents for Section 3"/>	
                     </s:VGroup>							
                  </s:NavigatorContent>
                  <s:NavigatorContent label="Section 4" width="100%" 
                     height="100%">
                     <s:VGroup verticalAlign="middle" horizontalAlign="center" 
                        width="100%" height="100%">
                        <s:Label text="Contents for Section 4"/>	
                     </s:VGroup>							
                  </s:NavigatorContent>
               </mx:TabNavigator>
            </s:Panel>
      </s:VGroup>	 
   </s:BorderContainer>	
</s:Application>

準(zhǔn)備好所有更改后,讓我們以正常模式編譯和運(yùn)行應(yīng)用程序,就像在 Flex - 創(chuàng)建應(yīng)用程序中一樣 章節(jié)。 如果一切順利,您的應(yīng)用程序,這將產(chǎn)生以下結(jié)果:[在線試用]

Flex TabNavigator Control
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)