Sencha touch Sencha Touch:将按钮与面板右侧和文本中心水平对齐
我想有一个面板,唯一的按钮对齐的权利。我知道“间隔器”的概念。但是另外我想水平设置一个html文本中心。但使用“间隔器”并不能真正起作用。文本实际上并不在讨论小组的中间。“间隔器”是如何工作的,我如何实现我想要的 js代码:Sencha touch Sencha Touch:将按钮与面板右侧和文本中心水平对齐,sencha-touch,panel,toolbar,alignment,Sencha Touch,Panel,Toolbar,Alignment,我想有一个面板,唯一的按钮对齐的权利。我知道“间隔器”的概念。但是另外我想水平设置一个html文本中心。但使用“间隔器”并不能真正起作用。文本实际上并不在讨论小组的中间。“间隔器”是如何工作的,我如何实现我想要的 js代码: this.topPanel = new Ext.Panel({ layout: 'hbox', height: 50, cls: 'topPanelCls', items: [
this.topPanel = new Ext.Panel({
layout: 'hbox',
height: 50,
cls: 'topPanelCls',
items: [
{xtype: 'spacer'},
{html: 'TextText', width: 100, height: 30},
{xtype: 'spacer'},
this.forwardButton
]
}))
“forwardButton”的样式:
.forwardButtonCls {
background: #ccc;
color: #ffffff;
font-size: 14px;
border: none;
vertical-align: center; }
托帕内尔的风格:
.topPanelCls {
margin: 10px 0px 0px 0px; }
.topPanelCls .x-panel-body {
background-color: #fff !important;
background-image: none !important;
width: 700px;
border:4px solid #ccc; }
你知道我怎样才能解决我的问题吗?我也遇到过类似的问题。我想在左边有一个后退按钮,在中间有一个分段按钮。我所做的是将backbutton flex属性设置为1,效果很好。segmentedbutton现在为我居中。希望这对你的问题有帮助
{xtype: 'toolbar',ui: 'light',pack: 'center', items:[
{xtype: 'BackButton', flex: 1},
{xtype: 'segmentedbutton', items:[
{text: 'Active', pressed: true},
{text: 'Won'},
{text: 'Lost'}
]},
{xtype: 'spacer'}
]}
{xtype:'spacer'}
是为我做的。谢谢