2012-05-18 75 views
1

我想在view.js中顯示沒有標籤面板的圖像 但是,儘管遵循了文檔,但似乎無法工作。任何人都可以幫助指出我做錯了什麼嗎?Sencha在標籤面板中觸摸顯示圖像

謝謝

App.js

Ext.application({ 
    name: 'hoodhelp1a', 

    requires: [ 
     'Ext.MessageBox' 
    ], 

    views: ['Main'], 

    isIconPrecomposed: true, 

    launch: function() { 
     // Destroy the #appLoadingIndicator element 
     Ext.fly('appLoadingIndicator').destroy(); 

     // Initialize the main view 
     Ext.Viewport.add(Ext.create('hoodhelp1a.view.Main')); 
    }, 

    onUpdated: function() { 
     Ext.Msg.confirm(
      "Application Update", 
      "This application has just successfully been updated to the latest version. Reload now?", 
      function(buttonId) { 
       if (buttonId === 'yes') { 
        window.location.reload(); 
       } 
      } 
     ); 
    } 
}); 

查看/ Main.js

Ext.define("hoodhelp1a.view.Main", { 
    extend: 'Ext.tab.Panel', 
    requires: [ 
     'Ext.TitleBar', 
     'Ext.Video', 
     'Ext.Img', 
    ], 
    config: { 
     tabBarPosition: 'bottom', 

     items: [ 
      { 
       title: 'Home', 
       iconCls: 'home', 
       xtype: 'container', 
       layout: 'hbox', 
       items: [ 
       { 
        docked: 'top', 
        xtype: 'titlebar', 
        title: 'Welcome to Sencha Touch 2' 
       }, 
       { 
         xtype: 'image', 
         src: 'http://www.sencha.com/assets/images/sencha-avatar-64x64.png' 
       } 
      ] 
      }, 
      { 
       title: 'Get Started', 
       iconCls: 'action', 

       items: [ 
        { 
         docked: 'top', 
         xtype: 'titlebar', 
         title: 'Getting Started' 
        }, 
        { 
         xtype: 'video', 
         url: 'http://av.vimeo.com/64284/137/87347327.mp4?token=1330978144_f9b698fea38cd408d52a2393240c896c', 
         posterUrl: 'http://b.vimeocdn.com/ts/261/062/261062119_640.jpg' 
        } 
       ] 
      } 
     ] 
    } 
}); 

回答

2

由於您使用您的第一個標籤頁中 '容器' 一個 '橫向盒' 佈局,你必須指定'flex'配置。 (例如,在'image'配置中設置'flex:1')。

另一種方法是將此「容器」的佈局設置爲「適合」。

順便說一下,'xtype:container'不是必需的。

看到這個搗鼓說明用途: http://www.senchafiddle.com/#X0Ejm

+0

謝謝!這是一個很大的幫助。 – shaoming