如何在Sencha Touch 2上设置启动画面和启动画面?

时间:2013-08-16 07:22:59

标签: sencha-touch-2

我不确定启动画面和启动画面是否相同。

我为Android使用Phonegap构建应用程序。

我在构建app android使用phonegap时放了代码java:

public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.setIntegerProperty("splashscreen", R.drawable.splash);
        // Set by <content src="index.html" /> in config.xml
        super.loadUrl(Config.getStartUrl(),5000);
        //super.loadUrl("file:///android_asset/www/index.html")
    }

启动屏幕我把代码放在app.js中:

Ext.Loader.setPath({
    'Ext': 'touch/src'
});


Ext.application({
    name: 'Project-catalog',

    requires: [
        'Ext.MessageBox'
    ],
    controllers: [
        'Main' , 'searchCon'
    ],
    models: [
        'appsModel' , 'catModel'
    ],
    stores: [
        'appsStore' , 'catStore'
    ],

    views: [
        'Main' , 'Home' , 'Navigation' , 'showSearchCategory' , 'SearchQ'
    ],

    icon: {
        '57': 'resources/icons/Icon.png',
        '72': 'resources/icons/Icon~ipad.png',
        '114': 'resources/icons/Icon@2x.png',
        '144': 'resources/icons/Icon~ipad@2x.png'
    },

    isIconPrecomposed: true,

    startupImage: {
        '320x460': 'resources/startup/320x460.jpg',
        '640x920': 'resources/startup/640x920.png',
        '768x1004': 'resources/startup/768x1004.png',
        '748x1024': 'resources/startup/748x1024.png',
        '1536x2008': 'resources/startup/1536x2008.png',
        '1496x2048': 'resources/startup/1496x2048.png'
    },

    phoneStartupScreen:'resources/startup/640x920.png',
    tabletStartupScreen: 'resources/startup/748x1024.png',

    launch: function() {
        // Destroy the #appLoadingIndicator element
        // Ext.fly('appLoadingIndicator').destroy();

        // Initialize the main view
        Ext.Viewport.add(Ext.create('Project-catalog.view.Main'));
    },

    onUpdated: function() {
        Ext.Msg.confirm(
            "Application Update",
            "This application has just successfully been updated to the latest version. Reload now?",
            function(buttonId) {
                if (buttonId === 'yes') {
                    window.location.reload();
                }
            }
        );
    }
});

当我在模拟器中创建应用程序启动画面时显示。当启动画面破坏时.App有背景颜色bluesky所以显示应用程序

我的代码是否错误?

1 个答案:

答案 0 :(得分:0)

启动画面是原生的东西。 Phonegap提供了一个桥接api来通过JS处理它:

navigator.splashscreen.show();
navigator.splashscreen.hide();

您应该在 Ext.application :: launch()

中调用navigator.splashscreen.hide()

看看:

http://docs.phonegap.com/en/2.9.0/cordova_splashscreen_splashscreen.md.html

希望有所帮助