成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Sencha Touch快速入門2.0之Box布局

移動開發
Sencha Touch快速入門2.0之Box布局是本文要介紹的內容,Sencha touch里的布局應該理解為:該控件內部子項的排列方式。

Sencha Touch快速入門2.0之Box布局是本文要介紹的內容,上一篇講到Sencha Touch快速入門2.0之Chorme瀏覽器調試功能介紹,接著在學習布局的內容。

Sencha Touch里的布局有五種

hbox

vbox

card

fit

auto[默認]

實際上可以分為Box布局和Fit布局兩種。

Sencha touch里的布局應該理解為:該控件內部子項的排列方式。

我們今天先來看看box布局

Box布局

顧名思義,box布局就是一個個的box組成的。

hbox: 水平排列、垂直居中、靠左置頂

vbox: 豎直堆疊、水平居中、靠上置頂

hbox:

  1. hbox   
  2. Ext.setup({      
  3.   tabletStartupScreen: 'tablet_startup.png',      
  4.   phoneStartupScreen: 'phone_startup.png',      
  5.   icon: 'icon.png',      
  6.   glossOnIcon: false,      
  7.   onReady : function() {          
  8.     var pnl = new Ext.Panel({              
  9.     fullscreen: true,              
  10.     layout: 'hbox',              
  11.   items:[                  
  12.      {xtype:'button',text:'按鈕1'},                  
  13.      {xtype:'button',text:'按鈕2'},                  
  14.      {xtype:'button',text:'按鈕3'}             
  15.      ]         
  16.    });      
  17. }});  
  18.    
  19. vbox: 

Sencha Touch快速入門2.0之Box布局

將以上的hbox改為vbox

Sencha Touch快速入門2.0之Box布局

但是,只是知道這些,還不足以玩轉box布局,下面讓我們看看其他常見的box布局實例。

vbox變型:

  1. vbox變型   
  2. Ext.setup({      
  3. tabletStartupScreen: 'tablet_startup.png',      
  4. phoneStartupScreen: 'phone_startup.png',      
  5. icon: 'icon.png',      
  6. glossOnIcon: false,      
  7. onReady : function() {          
  8. var pnl = new Ext.Panel({              
  9. fullscreen: true,              
  10. layout: 'vbox',              
  11. defaults: {                  
  12. flex: 1              
  13. },              
  14.   items:[                  
  15.   {xtype:'button',text:'按鈕1'},                  
  16.   {xtype:'button',text:'按鈕2'},                  
  17.   {xtype:'button',text:'按鈕3'}             
  18.   ]          
  19.  });      
  20. }}); 

Sencha Touch快速入門2.0之Box布局

關于這里的flex,sencha Touch使用了css3中的彈性和模型,所以大家如果有興趣可以看看 擴展閱讀:css3中的彈性盒模型

vbox變型2:

在上面代碼的defaults中加入width : '100%',得到下圖

Sencha Touch快速入門2.0之Box布局

了解以上內容之后,我們來想想經典的九宮格布局如何實現吧!

相必大家也已經心中有數了。

經典的九宮格布局:

九宮格

  1. Ext.setup({      
  2. tabletStartupScreen: 'tablet_startup.png',    p  
  3. honeStartupScreen: 'phone_startup.png',      
  4. icon: 'icon.png',      
  5. glossOnIcon: false,      
  6. onReady : function() {          
  7. var pnl = new Ext.Panel({              
  8. fullscreen: true,             
  9.  layout: 'vbox',              
  10.  defaults: {                  
  11.  flex: 1,                  
  12.  width: '100%',                  
  13.  defaults: {                      
  14.  flex: 1,                     
  15.   height: '100%'    
  16.   }                  
  17.  },              
  18.  items:[{                 
  19.        xtype: 'panel',    
  20.        layout: 'hbox',    
  21.  items:[                      
  22.     {xtype:'button',text:'按鈕1'},    
  23.     {xtype:'button',text:'按鈕2'},   
  24.     {xtype:'button',text:'按鈕3'}     
  25.   ]              
  26.  },{                 
  27.  xtype: 'panel',       
  28.  layout: 'hbox',     
  29. items:[                      
  30.    {xtype:'button',text:'按鈕4'},    
  31.    {xtype:'button',text:'按鈕5'},  
  32.    {xtype:'button',text:'按鈕6'}]    
  33.  },{                  
  34.  xtype: 'panel',  
  35.  layout: 'hbox',   
  36.  items:[    
  37.  {xtype:'button',text:'按鈕7'},    
  38.  {xtype:'button',text:'按鈕8'},   
  39.  {xtype:'button',text:'按鈕9'}   
  40. ]             
  41. }]          
  42. });     
  43. }}); 

Sencha Touch快速入門2.0之Box布局

嫌緊挨著不舒服?別急,我們還有些屬性沒用上!你沒有猜錯那就是-----margin、padding!你知道怎么做的!

松散九宮格:

松散九宮格

  1. Ext.setup({     
  2.   tabletStartupScreen: 'tablet_startup.png',      
  3.   phoneStartupScreen: 'phone_startup.png',      
  4.   icon: 'icon.png',      
  5.   glossOnIcon: false,      
  6.   onReady : function() {          
  7.     var pnl = new Ext.Panel({     
  8.     fullscreen: true,    
  9.     layout: 'vbox',   
  10.     defaults: {     
  11.   flex: 1,      
  12.   width: '100%',    
  13.    padding: 10,   
  14.    defaults: {    
  15.     flex: 1,     
  16.     height: '100%',   
  17.     margin: 10                  
  18.   }                  
  19. },              
  20.  items:[{         
  21.           xtype: 'panel',   
  22.           layout: 'hbox',   
  23.  items:[           
  24.             {xtype:'button',text:'按鈕1'},   
  25.             {xtype:'button',text:'按鈕2'},   
  26.             {xtype:'button',text:'按鈕3'}          
  27.       ]            
  28.    },{                 
  29.     xtype: 'panel',   
  30.     layout: 'hbox',    
  31.     items:[            
  32.               {xtype:'button',text:'按鈕4'},    
  33.               {xtype:'button',text:'按鈕5'},      
  34.               {xtype:'button',text:'按鈕6'}       
  35.           ]             
  36.     },{                  
  37.      xtype: 'panel',                  
  38.      layout: 'hbox',       
  39.   items:[                      
  40.      {xtype:'button',text:'按鈕7'},     
  41.      {xtype:'button',text:'按鈕8'},      
  42.      {xtype:'button',text:'按鈕9'}     
  43.    ]              
  44.  }]          
  45. });      
  46. }}); 

Sencha Touch快速入門2.0之Box布局

OK,到這里,你已經可以對box已經可以運用自如了,下一篇,我們將接著講解sencha touch里的另一種布局“Fit”布局

小結:Sencha Touch快速入門2.0之Box布局的內容介紹完了,希望通過本文的學習能對你有所幫助!

責任編輯:zhaolei 來源: 博客園
相關推薦

2011-09-02 15:58:38

Sencha Touc布局

2011-09-02 15:18:49

Sencha Touc

2011-09-02 16:08:09

Sencha ToucAPI文檔

2011-09-02 15:28:10

Sencha Touc瀏覽器

2011-10-26 10:12:53

Sencha Touc布局

2011-09-30 14:15:10

Sencha ToucSencha Touc

2011-10-26 10:43:19

Sencha Touc

2012-01-10 13:21:33

Sencha Touc使用data包

2011-10-26 10:21:40

Sencha Touc組件

2011-09-02 15:12:29

PhoneGapSencha Touc

2011-10-18 09:49:40

新特征Sencha Touc

2011-10-26 10:32:05

Sencha Touc數據視圖

2011-07-25 15:55:21

Sencha ToucHtml 5

2011-07-26 09:41:50

Sencha Touc特性HTML 5

2010-11-22 10:31:17

Sencha touc

2011-11-16 13:14:02

Sencha TouciOS本地應用

2011-07-26 09:46:53

Sencha Touc

2011-07-25 16:21:22

Sencha touc

2011-09-05 10:20:21

Sencha ToucAPP

2011-07-25 16:41:16

Sencha Touc
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 国产高清一区二区 | 精品国产不卡一区二区三区 | 久久成人免费 | 成人在线免费看 | 福利视频网站 | 91精品久久久久久久久久 | 国产日韩中文字幕 | 久久综合一区二区三区 | 国产黄色大片网站 | 午夜精品视频 | 免费看a | 日韩欧美一区二区在线播放 | 亚洲一区二区三区在线视频 | 亚洲国产视频一区二区 | 久久亚洲精品国产精品紫薇 | 精品免费视频 | 国产精品区二区三区日本 | 成人a视频片观看免费 | 日本黄色免费大片 | 国产精品欧美一区二区三区不卡 | 草比网站 | 午夜免费在线观看 | 在线成人免费观看 | 国产aⅴ爽av久久久久久久 | 天天操欧美 | 一区二区三区国产在线观看 | 国产精品久久a | 网站国产 | 中文精品视频 | 91丨国产| 一区二区三区免费看 | 日韩高清中文字幕 | 国产日韩一区二区三区 | 日韩中文字幕一区二区 | 免费av手机在线观看 | 亚洲网在线 | 日韩国产中文字幕 | 久久99精品久久久久久国产越南 | 国产精品不卡一区 | 国产欧美一区二区三区在线看蜜臀 | 精品九九九 |