加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex – 如何制作选项卡式面板

发布时间:2020-12-15 01:45:59 所属栏目:百科 来源:网络整理
导读:我的应用程序有3类按钮,我想有一个标签面板,我可以用来在这个类别中切换3个类别 我的应用程序是一个移动应用程序,所以我不能使用mx组件.当我尝试搜索移动选项卡式导航等时,我只提出了viewnavigator示例. 解决方法 对于移动选项卡式应用程序,您只需使用 Tabbe
我的应用程序有3类按钮,我想有一个标签面板,我可以用来在这个类别中切换3个类别

我的应用程序是一个移动应用程序,所以我不能使用mx组件.当我尝试搜索移动选项卡式导航等时,我只提出了viewnavigator示例.

解决方法

对于移动选项卡式应用程序,您只需使用 TabbedViewNavigatorApplication类:

第一种方法
????
????????
????????
????????
????

您的视图只是使用< s:View>的MXML组件.作为根本说明.

阅读您的评论,我发现您需要在视图中使用标签栏.在普通的Flex中,您可以使用TabBar并将其附加到ViewStack,但ViewStack在移动设备中不可用…因此您可以即兴使用状态,将TabBar绑定到状态名称并根据状态隐藏/显示面板.这是一个例子:

第二种方法*

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">

    <s:layout>
        <s:VerticalLayout />
    </s:layout>

    <s:states>
        <s:State name="One" />
        <s:State name="Two" />
        <s:State name="Three" />
    </s:states>

    <s:TabBar id="tabBar" width="100%" 
              change="currentState = tabBar.dataProvider[event.newIndex]">
        <s:ArrayCollection>
            {states.map(function(x) { return x.name; }) }
        </s:ArrayCollection>
    </s:TabBar>

    <s:Group includeIn="One" width="100%" height="100%">
        <s:Label text="Tab One" />
    </s:Group>

    <s:Group includeIn="Two" width="100%" height="100%">
        <s:Label text="Tab Two" />
    </s:Group>

    <s:Group includeIn="Three" width="100%" height="100%">
        <s:Label text="Tab Three" />
    </s:Group>

</s:View>

但是,您可能仍希望保留移动选项卡导航功能,但仅限于一个特定视图.您可以在视图中包含TabbedViewNavigator,而不是使用TabbedViewNavigatorApplication.

第三种方法

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">

    <s:TabbedViewNavigator width="100%" height="100%">
        <s:ViewNavigator label="1st Tab" width="100%" height="100%" 
                         firstView="views.FirstTabView"/>
        <s:ViewNavigator label="2nd Tab" width="100%" height="100%" 
                         firstView="views.SecondTabView"/>
        <s:ViewNavigator label="3rd Tab" width="100%" height="100%" 
                         firstView="views.ThirdTabView"/>
    </s:TabbedViewNavigator>

</s:View>

您将获得一个嵌套的“操作栏”,以便您可以通过设置actionBarVisible =“false”来禁用每个选项卡视图中的嵌套一个

希望这可以帮助!!!!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读