sencha button 右對齊的問題
阿新 • • 發佈:2019-02-03
你可能試驗過
docked:'right'
然後右邊上下對不齊
你可能試驗過
right:'0%'
top'10%'
很難看
你可能試驗過
align:'right'
對不起,button沒有這個屬性
so。。。答案是
items: [{ xtype: 'button', ui: 'mask', iconCls: 'refresh', handler: refresh }, {xtype: 'spacer'}, { xtype: 'button', ui: 'mask', iconCls: 'add', handler: refresh }]
加一個space搞定
Just to explain the reason behind this. In Sencha Touch, toolbars are nothing more
than containers with an hbox layout and custom styling. So in order to alter the alignment, the pack and other hbox layout configuration you could do:
layout: { pack: 'justify', align: 'center' // align center is the default }
Finally I just wanted to paste the code for the Spacer class to show you what it does.
Code:
Ext.Spacer = Ext.extend(Ext.Component, { initComponent : function() { if (!this.width) { this.flex = 1; } Ext.Spacer.superclass.initComponent.call(this); } });
I hope this answered your question.