2012-11-09 54 views
1

我只是sencha觸摸技術的初學者。現在我有一個簡單的問題。如何調整字段集寬度並僅對齊到中心?我只獲取僅設置爲全屏的字段集。請給我一個解決方案。調整字段集寬度並調整到中心

這裏我的javascript

  items:[{ 
       xtype:'fieldset', 
       title :'Please enter your password key', 

       centered: true, 
       width: 30, 

       items:[{ 
         xtype: 'passwordfield', 
         name : 'password', 
         label: 'password', 
         width : 400, 



        }] 






       }], 

回答

3

不要在代碼中使用硬編碼值,這就是當你做了多分辨率的應用程序壞

請嘗試它下面的代碼對我的作品

layout: { 
      type: 'vbox', 
      pack: 'center', 
      align: 'center' 
     }, 
    items:[{ 
       xtype:'fieldset', 
       title :'Please enter your password key', 

       //centered: true, 
       //width: 30, 

       items:[{ 
         xtype: 'passwordfield', 
         name : 'password', 
         label: 'password', 
         //width : 400, 
       }] 
    }] 

感謝

0

試試這個,

items:[{ 
       xtype:'fieldset', 
       title :'Please enter your password key', 

       centered: true, // using this you can align fieldset to center 
       width: '80%', // using this you can give any width to it in percentage 

       items:[{ 
        xtype: 'passwordfield', 
        name : 'password', 
        label: 'password',  
        }] 
       }], 

OR

items:[{ 
       xtype:'fieldset', 
       title :'Please enter your password key', 

      // centered: true, 
       margin: '10%', 
       width: '80%', 
       height: '20%', 

       items:[{ 
        xtype: 'passwordfield', 
        name : 'password', 
        label: 'password', 
        }] 

       }], 

希望這可以幫助你。

0

嘗試

風格:{ textAlign設置: '中心', 寬度: '100px的'}

0
在ST2

把它放在容器內這樣

{ 
    xtype: 'container', 
    centered: true, 
    items:{ 
     xtype: 'fieldset', 
     items :[ 
     //your items here 
     ] 
    } 
}