Sencha touch 调整字段集宽度并调整到中心

Sencha touch 调整字段集宽度并调整到中心,sencha-touch,width,center,padding,fieldset,Sencha Touch,Width,Center,Padding,Fieldset,我只是sencha touch技术的初学者。现在我有一个简单的问题。如何调整字段集宽度并仅与中心对齐?我只得到全屏设置的字段集。请给我一个解决办法 这是我的javascript items:[{ xtype:'fieldset', title :'Please enter your password key', centered: true, wi

我只是sencha touch技术的初学者。现在我有一个简单的问题。如何调整字段集宽度并仅与中心对齐?我只得到全屏设置的字段集。请给我一个解决办法

这是我的javascript

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

                centered: true,
                width: 30,

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



                    }]






              }],

不要在代码中使用硬编码的值,这在使用多分辨率应用程序时很糟糕

请尝试下面显示的代码,它适合我

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,
               }]
     }]
谢谢你试试这个

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',      
                     }]  
              }], 

希望这对您有所帮助。

试试看

风格:{ textAlign:'中心', 宽度:ST2中的“100px”}

像这样把它放在容器里

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