javascript - Sencha Touch 中的嵌套面板/工具栏

标签 javascript mobile sencha-touch extjs

我正在尝试创建一个常量底部工具栏,它控制其上方的面板。然后它上面的面板应该有一个自己的工具栏(在顶部)。我已经尝试了下面的代码,它几乎可以工作,但是我看不到子页面内部面板的 html。我认为这是因为面板没有占据剩余的高度,但我不知道为什么。

有人有什么想法吗?谢谢!

Ext.setup({
    onReady: function() {


    // Sub-page sections
    var blah = {
        style: "background-color: #B22222; color:#FF0000;",
        title: "one",
        html: "Why can't I see this html",
        layout:"fit",
        flex: 1
    };
    var blah2 = {
        style: "background-color: #404040; color:#000000;",
        title: "one",
        html: "Why can't I see this html",
        layout:"fit",
        flex: 1
    };  

    // Main portion of the page, which includes top toolbar and content
    var page1 = new Ext.TabPanel({
        dock: "bottom",
        layout: "card",
        items: [blah, blah2, blah],
        title: "one",
        flex: 1
    });

    // This is the outer panel with the bottom toolbar
    var wrapper = new Ext.Panel({
        fullscreen: true,
        items: page1,
        dockedItems: [
          {
            xtype: "toolbar",
            dock: "bottom",
            items: [
              {
                iconMask: true,
                iconCls: "download"
              },
              {
                iconMask: true,
                iconCls: "favorites"
              },
              {
                iconMask: true,
                iconCls: "search"
              },
              {
                iconMask: true,
                iconCls: "user"
              }
            ]  
          }
        ]
      });
    }
});

最佳答案

听起来您尝试做的事情可以使用 TabPanel 而不是工具栏来完成。当您将 tabBar 停靠在底部时,每个 tabButton 都可以接受一个图标。

我可能误解了您的意思,但这应该有所帮助:

Ext.setup({
    onReady: function() {


        // Sub-page sections
        var blah = {
            style: "background-color: #B22222; color:#FF0000;",
            title: "one",
            html: "Why can't I see this html",
        };
        var blah2 = {
            style: "background-color: #404040; color:#000000;",
            title: "one",
            html: "Why can't I see this html",
        };  

        // Main portion of the page, which includes top toolbar and content
        var page1 = new Ext.TabPanel({
            items: [blah, blah2, blah],
            title: "one",
            iconMask: true,
            iconCls: "download",
        });

        // This is the outer panel with the bottom toolbar
        var wrapper = new Ext.TabPanel({
            fullscreen: true,
            tabBar: {
                dock: 'bottom',
                layout: {
                    pack: 'center'
                }
            },
            items: [
                page1,
                {
                    iconMask: true,
                    iconCls: "favorites"
                },
                {
                    iconMask: true,
                    iconCls: "search"
                },
                {
                    iconMask: true,
                    iconCls: "user"
                }
            ]
        });
    }
});

我制作了关于 building a user interface in sencha touch using tabs and toolbars 的截屏视频.有一个 live demo , 和 code is on github ,所以请随意使用它作为引用。

关于javascript - Sencha Touch 中的嵌套面板/工具栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5630295/

相关文章:

java - 接收图像并使用 TCP 套接字显示它? (安卓)

mobile - 不带ga.js的Google Analytics(分析)

extjs - 我如何在Ext.Msg.show中包含两个文本框

javascript - Sencha Touch 2.2 列表不重用列表项

javascript - 如何使用正则表达式将句子中的多个单词加粗?

javascript - Backbone.js Collection.create 和覆盖的 Model.set

javascript - CSS 选择器通过属性名称开始匹配元素

jquery - 如何在适用于 Android 和 iOS 的 phonegap 应用程序中将所需页面的方向设置为横向和其他页面的纵向模式

sencha-touch - 为什么我应该使用Ext.dispatch而不是直接调用 Controller 代码?

javascript - Google map 事件监听器 jQuery