Sencha touch 如何在Sencha touch中调整面板的高度和宽度?
假设我有3个不同的面板[bottomCar0,bottomCar1,bottomCar2],并想根据我的要求调整它们的高度和宽度,我该怎么做 我的代码:Sencha touch 如何在Sencha touch中调整面板的高度和宽度?,sencha-touch,panel,Sencha Touch,Panel,假设我有3个不同的面板[bottomCar0,bottomCar1,bottomCar2],并想根据我的要求调整它们的高度和宽度,我该怎么做 我的代码: var bottomCar=new Ext.Panel({ layout:{ type:'hbox', align:'stretch' }, defaults:{
var bottomCar=new Ext.Panel({
layout:{
type:'hbox',
align:'stretch'
},
defaults:{
flex:1
},
items: [bottomCar0,bottomCar1,bottomCar2]
});
如何更改默认设置
ThnaksSneha问题是,您设置了flex:1。这将为您的每个项目提供属性flex:1。这将迫使它们捕获可用空间,从而捕获剩余空间,并根据设置的flex对象的数量进行划分 比如,在你的例子中,如果你有3个flex:1项目,那么每个项目将获得可用高度的33% 您需要做的是从默认设置中删除flex并将其交给面板本身,然后设置尺寸 您可以在默认值内设置高度和宽度,前提是所有这些值都相同
defaults:{
height: 200,
width: 300
}
或设置每个项目的高度和宽度
items: [
{
title: 'Home',
iconCls: 'home',
height: 200,
width: 300
},
{
title: 'Contact',
iconCls: 'user',
html: 'Contact Screen',
height: 100,
width: 150
}
]
Shlomi.或者您可以将“cls”添加到面板中,并在css文件中进行调整