android - Sencha Touch 2 - 旋转木马仅在构建后卡在第一个面板上

标签 android ios extjs sencha-touch-2 carousel

在我通过 sencha sdk 构建应用程序之前,我在面板中有一个旋转木马,它可以正常显示和工作。然而,在我构建它之后,轮播仍然正确显示,但不再允许我在项目之间滑动。

Ext.define('SycsApp.view.HotOffers', {
    extend: 'Ext.Panel',
    requires: ['Ext.carousel.Carousel', 'Ext.TitleBar'],

    config: {
            layout: 'card',
            items: [
                {
                    docked: 'top',
                    xtype: 'titlebar',
                    ui: 'top-sub',
                    title: 'Hot Offers',
                },
                {
                    id: 'hotOffersCarousel',
                    xtype: 'carousel',
                    width: '100%',
                    items: [
                        {
                            html : 'Item 1',
                            style: 'background-color: #5E99CC'
                        },
                        {
                            html : 'Item 2',
                            style: 'background-color: #759E60'
                        },
                        {
                            html : 'Item 3'
                        }
                    ]
                }
            ]
    }
});

将布局设置为卡片的原因是此 View 是包含选项卡面板的一部分。在构建后运行应用程序时,我也没有从控制台收到任何错误消息。

对于为什么会发生这种情况的任何帮助,我们将不胜感激。

最佳答案

问题是由将其添加到主卡片 View 的方式引起的。

Ext.define('SycsApp.view.Main', {
extend: 'Ext.tab.Panel',
xtype: 'mainView',
requires:  ['SycsApp.view.HotOffers'],

config: {
    tabBarPosition: 'bottom',
    id: 'MainView',
    ui: 'bottom',
    layout: 'card',
    items: [
        {
            title: 'Hot Offers',
            layout: 'fit',
            iconCls: 'hotoffer',
            //items: [Ext.create('SycsApp.view.HotOffers')], // carousel doesn't work after build
            items:  [{xtype: 'hotOffersView'}] // carousel works after build
        },
        {
            title: 'All Savings',
            layout: 'fit',
            iconCls: 'list',
            items:  [{xtype: 'allSavingsMainView'}]
        }
    ]
}

});

必须将 xtype: 'hotOffersView' 添加到 Hot Offers View :

Ext.define('SycsApp.view.HotOffers', {
    extend: 'Ext.Panel',
    xtype: 'hotOffersView',
    requires: ['Ext.carousel.Carousel', 'Ext.TitleBar'],

    config: {
            layout: 'card',
            items: [
                {
                    docked: 'top',
                    xtype: 'titlebar',
                    ui: 'top-sub',
                    title: 'Hot Offers',
                },
                {
                    id: 'hotOffersCarousel',
                    xtype: 'carousel',
                    width: '100%',
                    items: [
                        {
                            html : 'Item 1',
                            style: 'background-color: #5E99CC'
                        },
                        {
                            html : 'Item 2',
                            style: 'background-color: #759E60'
                        },
                        {
                            html : 'Item 3'
                        }
                    ]
                }
            ]
    }
});

关于android - Sencha Touch 2 - 旋转木马仅在构建后卡在第一个面板上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12593004/

相关文章:

android - Gradle中的任务 ':app:processDebugManifest'执行失败

android - AlarmManager 为选定日期的每周重复设置警报

ios - 尝试使用 AVFoundation 从前置摄像头捕获照片时出现 fatal error

ios - 从 CoreData 中的属性中删除所有数据

javascript - 分机JS 4 : Generate Chart from nested Data

extjs - 如何用ExtJS销毁一个对象的所有实例?

javascript - 在没有jquery的情况下检测html输入中的Enter按键

android - picasso 在使用 View 持有者模式时加载到错误的 ImageView 中

ios - 最初使用非零值调用的 numberOfRowsInSection

extjs - ExtJs4 中的单例