Sencha Touch:如何将底部对接工具栏中的两个按钮居中对齐?

nin*_*nse 2 javascript mobile extjs sencha-touch sencha-touch-2

我想知道如何在底部停靠的工具栏中居中对齐两个按钮.在我看到的buttosn上解决这个问题的唯一属性是,centered但它们中心与按钮完全重叠,有没有办法将它们分组在中心?

以下是我一直在使用的一些代码:http: //www.senchafiddle.com/#xTZZg#k24Ni

Ext.Loader.setConfig({
    enabled: true
});

Ext.application({
    name: 'SenchaFiddle',

    launch: function () {

        var panelNewForm = Ext.create('Ext.Panel', {
            id: 'panelNewForm',
            title: 'TEST',
            html: 'TEST',
            pack: 'center',
            items: [{
                xtype: 'toolbar',
                docked: 'bottom',
                layout: {
                    type: 'hbox',
                    align: 'center'
                },
                items: [{
                    ui: 'decline',
                    text: 'Cancel',
                    handler: function () {

                    }
                }, {
                    ui: 'confirm',
                    text: 'Save',
                    handler: function () {

                    }
                }]
            }]
        });
        Ext.Viewport.add(panelNewForm);
    }
});
Run Code Online (Sandbox Code Playgroud)

Eli*_*Eli 10

你可以给你toolbar一个布局配置:

layout: {
    pack: 'center',
    type: 'hbox'
}
Run Code Online (Sandbox Code Playgroud)

这将使您的项目水平呈现在此工具栏的中心.