ExtJS 4在'中居中显示文本;盒子';要素
在我的界面中,我使用以下结构:ExtJS 4在'中居中显示文本;盒子';要素,extjs,extjs4,Extjs,Extjs4,在我的界面中,我使用以下结构: xtype: 'container', layout: { type: 'hbox', align: 'stretch' }, items: [ { xtype: 'fieldset', flex: 2, layout: { type: 'vbox', align: 'stretch' }, margin: '0 5 0 0', padding: '10', i
xtype: 'container',
layout: {
type: 'hbox',
align: 'stretch'
},
items: [
{
xtype: 'fieldset',
flex: 2,
layout: {
type: 'vbox',
align: 'stretch'
},
margin: '0 5 0 0',
padding: '10',
items: [
{
xtype: 'container',
flex: 1,
layout: 'hbox',
items: [
{
xtype: 'combo',
flex: 1,
margin: '0 5 0 0',
name: 'deviceSelect',
...
},
{
xtype: 'button',
...
},
{
xtype: 'button',
...
}
]
},
{
xtype: 'box',
flex: 1,
name: 'deviceMessage'
...
}
]
},
{
...
},
{
...
}
组合“deviceSelect”应该占据容器的整个宽度,除了两个按钮的大小之外,它下面应该是文本。目前,一切都正常工作,只有一个例外——文本“固定”在其“deviceMessage”容器的顶部。如何把它放在容器的中间(垂直)?我尝试了样式:“垂直对齐:中间;”,但它不起作用(可能是因为extaddtop:24px)
我认为代码不是最优的。欢迎发表任何评论。类似这样的评论:
您需要的零件是布局
零件:
xtype: 'container',
name: 'deviceMessage',
layout: {
// Centers your inner panel with the HTML
type: 'vbox',
align: 'center',
pack: 'center'
},
//...
items: {
xtype: 'container',
html: 'sadfasdf<br>safasdfasf'
}
xtype:'container',
名称:'deviceMessage',
布局:{
//使用HTML将内部面板居中
键入:“vbox”,
对齐:'居中',
包装:'中心'
},
//...
项目:{
xtype:'容器',
html:'sadfasdf
safasdfasf'
}