2012-08-06 108 views
0

我正在嘗試構建一個界面,該界面具有標題欄,標題欄頂部居中。這是我正在使用的代碼。圖像不顯示。在運行時檢查元素時,元素顯示的高度爲'0',而不是使用100%來匹配包含元素的高度。標題中的圖像不會顯示

Ext.define("RFN.view.Main", { 
    extend: 'Ext.TabPanel', 

    config: { 
     tabBarPosition: 'bottom', 
     items: [ 
      { 
      title: 'Calculate', 
      iconCls: 'home', 
      //styleHtmlContent: true, 
      //scrollable: true, 
      layout: 'vbox', 
      items:[ 
       { 
       xtype: 'panel', 
       style: 'background-color: #174a7c;text-align:center;', 
       items:[ 
        { 
        xtype: 'image', 
        src: 'resources/images/logo.png', 
        height: '100%' 
        } 
       ], 
       flex: 1 
       }, 
       { 
       xtype: 'panel', 
       style: 'background-color: #999999;', 
       flex:4 
       } 
      ] 
      }, 
      { 
      title: 'Compare', 
      iconCls: 'chart2', 
      //styleHtmlContent: true, 
      //scrollable: true, 
      layout: 'vbox', 
      items:[ 
       { 
       style: 'background-color: #174a7c;', 
       flex: 1 
       }, 
       { 
       style: 'background-color: #999999;', 
       flex:4 
       } 
      ] 
      } 
     ] 
    } 
}); 

回答

0

只需在包含圖像的面板上添加布局配置即可。然後,您可以刪除圖像上的高度配置的佈局使內部項目符合整個高度,並自動寬度:

... 
xtype: 'panel', 
style: 'background-color: #174a7c;text-align:center;', 
items:[{ 
    xtype: 'image', 
    src: 'resources/images/logo.png', 
}], 
flex: 1 
... 

希望這有助於

0

或者你可以做我做,有一個佈局的vbox,標題的彈性爲0.3,我的tabpanel爲0.7。 0.3是一個面板,在類配置(cls)中我有我的CSS類名稱,例如頭。在我的CSS類.header中,我設置了背景和徽標。希望這有助於...