2014-02-24 46 views
5

如何對齊Sencha中的按鈕在左右兩側觸摸工具欄(每邊各有一個按鈕)?在Sencha Touch工具欄中左右對齊按鈕

在ExtJs中,我曾經使用' - >'。但是這在Sencha Touch中似乎不起作用。

任何想法?這裏

編輯 button image not completely right aligned should appear here

編輯 是我的代碼

Ext.define('reestructura.view.ContratoList', { 
    extend: 'Ext.List', 
    xtype: 'contratolist', 
    requires: 'Ext.field.Toggle', 
    config: { 
     onItemDisclosure: true, 
     emptyText: 'El contrato no existe', 
     store: 'Contratos', 
     items: [{ 
      xtype: 'toolbar', 
      docked: 'top', 
      style: 'background:darkgray', 
      items: [{ 
       xtype: 'searchfield', 
       placeHolder: 'Buscar contrato...' 
      }, { 
       xtype: 'button', 
       iconCls: 'search', 
       iconMask: true, 
       ui: 'confirm', 
       action: 'buscarContratos' 
      }, 

      { 
       xtype:'spacer' 
      }, 
      { 
       xtype: 'togglefield', 
       label: 'simulación' 
      } 
      ] 
     }], 

     itemTpl : [ 
     '<p>{idContrato}&nbsp &nbsp {nombreGrupo} </p>', 
     '<div style="font-size: 0.75em; color: darkgray">Saldo Pendiente: {saldoPendiente}</div>', 
     ].join('') 

    } 

}); 

回答

8

使用間隔 下面是一個例子

  { 
       xtype: 'button', 
       text: 'Button One' 
      }, { 
       xtype: 'spacer' 
      }, { 
       xtype: 'button', 
       text: 'Button Two' 
      } 

我希望幫助

+0

我已經做了,但按鈕沒有去工具欄的末尾有一些空間... –

+0

你能提供一些代碼嗎? – Darly

+0

當然,完成 –

2

以下工作,如果你可以用一個標題欄,而不是一個工具欄的

{ 
    xtype: 'titlebar', 
    docked: 'top', 
    items: [ 
     { 
      xtype: 'button', 
      text: 'Button 1', 
      align: 'left' 
     }, 
     { 
      xtype: 'button', 
      text: 'Button 2', 
      align: 'right' 
     } 
    ] 
} 

如果你必須使用一個工具欄,你可以嘗試

{ 
    xtype: 'toolbar', 
    docked: 'top', 
    items: [ 
     { 
      xtype: 'button', 
      text: 'Button 1', 
      docked: 'left' 
     }, 
     { 
      xtype: 'button', 
      text: 'Button 2', 
      docked: 'right' 
     } 
    ] 
} 

但按鈕文本不居中對齊。修改行高CSS屬性可能會修復對齊。

+0

停靠的屬性適用於我 – rxlky