使用Sencha Touch时在TabPanel中使用轮播

时间:2012-11-13 07:13:49

标签: extjs

我想问一下,在用sencha touch开发应用程序时,可以在TabPanel中添加Carousel吗? 我只想添加一个名为gallery的选项卡,并将一些图像放入旋转木马中。 请帮助..

代码如下......

Ext.application({
    name: 'Employee Form',
    launch: function () {
        Ext.create('Ext.TabPanel', {
            extend: 'Ext.Carousel',
            fullscreen: true,
            defaults: {
                styleHtmlContent: true
            },
            layout: {
                animation: {
                    type: 'slide'
                }
            },
            items: [
                {
                    title: 'Home',
                    html: 'You are on the Home Screen Now' + ['<center><img width="100%" height="350px" src="http://staging.sencha.com/img/sencha.png" /></center>'].join(""),
                    items: [
                        {
                            xtype: 'toolbar',
                            html: '<center>Muhammad Burhan</center>',
                            docked: 'bottom',
                        }
                    ]
                },
                {
                    title: 'Gallery',
                    items: [
                        {
                            xtype: 'carousel',
                            direction: 'vertical',
                            items: [
                                {
                                    html: 'Welcome' + ['<center><img width="60%" height="100%" src="lib/touch/img/welcome.gif"</center>'].join(),
                                },
                                {
                                    html: 'First Picture' + ['<center><img width="100%" height="100%" src="lib/touch/img/pic.jpg" /></center>'].join(""),
                                }
                            ]
                        }
                    ]
                },

2 个答案:

答案 0 :(得分:0)

以下是一个示例:http://www.senchafiddle.com/#DQ0wD

您实际上需要将第二个tabbar项目设置为轮播,而不是像您尝试的那样在您的tabbar项目中添加轮播项目。

希望这有帮助

答案 1 :(得分:0)

为什么不单独从“标签”面板创建带有图像的轮播,只是将轮播作为标题为“画廊”的项目?