2013-03-23 99 views
4

我提出了一個面板,在它的按鈕這樣的數目,在煎茶觸摸滾動面板

Ext.define('BeLocal.view.Test', { 
     extend: 'Ext.Panel', 

     config: { 
     fullScreen: true, 
     height: 482, 
     width: 324, 
     scrollable: 'vertical', 
     items: [ 
       { 
       xtype: 'button', 
       text: 'MyButton1' 
       }, 
       { 
       xtype: 'button', 
       top: '30%', 
       text: 'MyButton2' 
       }, 
       { 
       xtype: 'button', 
       top: '50%', 
       text: 'MyButton3' 
       }, 
       { 
       xtype: 'button', 
       top: '96%', 
       text: 'MyButton4' 
       }, 
       { 
       xtype: 'button', 
       top: '110%', 
       text: 'MyButton5' 
       } 
       ] 
     } 

     }); 

我可以僅顯示3按鈕現在。 我想這個面板滾動,這樣我可以通過滾動下來,顯示所有的按鈕,我已經設置屬性滾動:「垂直」,但它不工作。 當我刪除喜歡頂部的所有按鈕的位置:50%滾動工作正常,但我想在適當的位置所有的按鈕。 我該如何解決這個問題?

回答

0

作爲每文檔: http://docs.sencha.com/touch/2-1/#!/api/Ext.Button-cfg-top

頂部:數/字符串 這個分量的絕對值頂部位置;必須是有效的CSS長度值,例如:300,100像素,30%等顯式設置該值將使得該組件成爲「浮動」,這意味着其佈局將不再通過它駐留在集裝箱而受到影響。

嘗試設置風格配置:

items: [{ 
     xtype: 'button', 
     text: 'MyButton1' 
    },{ 
     xtype: 'button', 
     style:'margin-top: 10%;', 
     text: 'MyButton2' 
    },{ 
     xtype: 'button', 
     style:'margin-top: 50%;', 
     text: 'MyButton3' 
    },{ 
     xtype: 'button', 
     style:'margin-top: 96%;', 
     text: 'MyButton4' 
    },{ 
     xtype: 'button', 
     style:'margin-top: 110%;', 
     text: 'MyButton5' 
    }] 

似乎爲我工作。

+0

什麼我必須做的比添加一種風格嗎? 像我想設置的margin-top和margin-留在單一的風格.. – Master 2013-03-25 11:22:40

+0

@Master風格:「邊距:10%;利潤率左:20%;」, – 2013-03-25 11:27:20