Sencha touch 2 如何设置选项卡面板选项卡宽度和选项卡高度?

Sencha touch 2 如何设置选项卡面板选项卡宽度和选项卡高度?,sencha-touch-2,Sencha Touch 2,如何设置选项卡面板选项卡宽度和选项卡高度 我试过: var myTabPanel = Ext.create('Ext.TabPanel', { fullscreen: true, tabBarPosition: 'top', resizeTabs: true, tabWidth: 300, //minTabWidth: 300 .... 但是它不起作用这一切都发生在senchacss文件中。你需要在那里修改它 好消息 我已经找到了通过编程

如何设置选项卡面板选项卡宽度和选项卡高度

我试过:

var myTabPanel  = Ext.create('Ext.TabPanel', {  
   fullscreen: true,
   tabBarPosition: 'top', 
   resizeTabs: true,
   tabWidth: 300, 
   //minTabWidth: 300
        ....

但是它不起作用

这一切都发生在sencha
css
文件中。你需要在那里修改它

好消息

我已经找到了通过编程实现这一点的方法

//assuming you are using the MVC structure as suggested
/*In the controller class of your view with the tab panel you must have reference to the tab panel in refs config.
The reference name for this case will be: myTabpanel
*/

//somewhere in the controller class
var tabPanelItems = this.getMyTabpanel().getItems; //get all the items inside the tab panel (if i'm not mistaken this will also return some "extra" item which is not panel
for (var i = 0; i < panels.length; i++) {
  //due to that extra item i mentioned, need to make sure current item is a tab by confirming "tab" property existence
  if (panels.items[i].tab) {
    panels.items[i].setWidth('100px');
    panels.items[i].setHeight('25px');
  }
}
//假设您正在使用建议的MVC结构
/*在具有选项卡面板的视图的控制器类中,必须在refs config中引用选项卡面板。
此案例的引用名称为:myTabpanel
*/
//控制器类中的某个地方
var tabPanelItems=this.getMyTabpanel().getItems//获取选项卡面板中的所有项目(如果我没有弄错的话,这也会返回一些“额外”项目,而这些项目不是面板中的项目
对于(变量i=0;i
就这样。
关键的一点是,它是一个选项卡面板(带面板的选项卡),因此要只配置选项卡部分,我们首先需要获取选项卡部分,否则默认情况下我们将只配置面板部分。

您在哪里找到这些配置:resizeTabs、tabWidth、minTabWidth?这是关于EXTJS 3而不是Sencha Touch 2的讨论