Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sencha touch 如何在sencha touch中的工具栏中添加简单文本_Sencha Touch_Extjs_Sencha Touch 2 - Fatal编程技术网

Sencha touch 如何在sencha touch中的工具栏中添加简单文本

Sencha touch 如何在sencha touch中的工具栏中添加简单文本,sencha-touch,extjs,sencha-touch-2,Sencha Touch,Extjs,Sencha Touch 2,嗨,我需要在工具栏中添加一个简单的文本,文本应该在工具栏内声明的两个按钮之间,你知道怎么做吗?请让我知道谢谢这里有两个选项你可以使用: 如果只希望文本位于工具栏的中心,请使用“标题”属性: { title: 'Some text here', items [/* Your buttons */] } 如果您需要多个文本元素,一种快速而肮脏的方法是使用带有html属性集的面板,这将用html替换所创建面板的内容: { items [{ // Button

嗨,我需要在工具栏中添加一个简单的文本,文本应该在工具栏内声明的两个按钮之间,你知道怎么做吗?请让我知道谢谢这里有两个选项你可以使用:

如果只希望文本位于工具栏的中心,请使用“标题”属性:

{
    title: 'Some text here',
    items [/* Your buttons */]
}
如果您需要多个文本元素,一种快速而肮脏的方法是使用带有html属性集的面板,这将用html替换所创建面板的内容:

{
    items [{
        // Button 1
    },{
        xtype: 'panel',
        html: 'The text you want here'
    },{
        // Button 2
    }]
}
如果执行此操作,面板的样式可能不太好,因此您可能必须对面板的
样式
baseCls
属性应用一些样式,以便按需要重新设置其样式

请注意,在ExtJS中,您可以只在项目列表中包含文本,它将执行您想要的操作,但是文档没有明确说明这在Sencha Touch中是否有效,我现在无法测试这一点。如果这真的起作用,它看起来会像这样:

{
    title: 'Some text here',
    items [items [{
        // Button 1
    },
    'Your text here',
    {
        // Button 2
    }]
}

在我看来,最简单的解决方案是使用。

以下是在工具栏上的两个按钮之间添加简单文本的代码

{
   xtype: 'toolbar',
   docked: 'top',
   **title: 'text you want to add here'**,
   items:[{
            xtype: 'button',
            ui: 'action',
            text: '1st button'
          },
          {
            xtype: 'button',
            ui: 'action',
            right: '0%',
            text: '2nd button',
          }
        ],
}

希望这对你有帮助。
谢谢。

好的。在按钮中,可以添加“对齐:右/左”属性。