Sencha touch 定制sencha触摸工具栏

Sencha touch 定制sencha触摸工具栏,sencha-touch,sencha-touch-2,sencha-touch-theming,Sencha Touch,Sencha Touch 2,Sencha Touch Theming,我想使用sencha touch创建一个自定义工具栏。使用外部工具栏,我能够创建一个像样的屏幕标题栏。但我的要求是把我公司的品牌形象标志放在标题栏的中心,而不是下面代码提供的简单文本 { xtype : 'toolbar', docked: 'top', title: 'My Toolbar' } 有人能帮我怎么做吗?试试这个 { xtype: 'toolbar', docked: 'top', layout: { type: 'vbo

我想使用sencha touch创建一个自定义工具栏。使用外部工具栏,我能够创建一个像样的屏幕标题栏。但我的要求是把我公司的品牌形象标志放在标题栏的中心,而不是下面代码提供的简单文本

{
   xtype : 'toolbar',
   docked: 'top',
   title: 'My Toolbar'
}
有人能帮我怎么做吗?

试试这个

{
    xtype: 'toolbar',
    docked: 'top',
    layout: {
        type: 'vbox',
        align: 'center',
        pack: 'center'
    },
    items: [
        {
            xtype: 'image',
            width:218,
            height:44,
            src:'http://cdn.sstatic.net/careers/gethired/img/careers2-ad-header-so-crop.png'
        }
    ]
}

可以使用title属性在工具栏中添加图像。下面是我的一个应用程序的一些修改代码。此外,通过定义自定义类,您可以指定自定义xtype并重用主工具栏。。。无论哪种方式,代码都应该具有您想要的内容:

Ext.define('myApp.view.Maintoolbar', {
    extend: 'Ext.Toolbar',
    xtype: 'maintoolbar',
    requires: [
        //any necessary requirements
    ],
    config: {
        docked: 'top',
        title: '<div style="text-align:center;"><img src="images/logoSmall.png" width="185" height="36" alt="Company Name"></div>',
        padding: '5 5 5 5',
        items: [{
            iconCls: 'arrow_down',
            iconMask: true,
            ui: 'normal',
            //left: true,
            text: 'Menu',
            action: 'openmenu'
        },{
            xtype: 'spacer'
        },{
            xtype: 'button',
            iconCls: 'arrow_down',
            iconMask: true,
            ui: 'normal',
            align: 'right',
            text: 'Logout',
            action: 'logout'
        }]
    },
    initialize: function() {
        this.callParent();
    }
});
Ext.define('myApp.view.Maintoolbar'{
扩展:“Ext.Toolbar”,
xtype:'maintoolbar',
要求:[
//任何必要的要求
],
配置:{
停靠:“顶部”,
标题:“”,
填充:“5”,
项目:[{
图标包括:“向下箭头”,
是的,
ui:'正常',
//左:对,
文本:“菜单”,
操作:“openmenu”
},{
xtype:“间隔器”
},{
xtype:'按钮',
图标包括:“向下箭头”,
是的,
ui:'正常',
对齐:“右”,
文本:“注销”,
操作:“注销”
}]
},
初始化:函数(){
这是callParent();
}
});

您是否尝试过类似于标题:“”的内容?还是使用带有背景图像的div?