2011-08-18 118 views
0

我有一個網格,我將內容添加到ir。問題是這些項目會滾動到網格佈局之外。我希望物品在網格內,不要超出它。以下是代碼片段。黑莓網格問題

gridbackManager = new VerticalFieldManager(
     VerticalFieldManager.NO_HORIZONTAL_SCROLL | 
     VerticalFieldManager.VERTICAL_SCROLL) { 

    protected void paintBackground(Graphics graphics) { 
     int c = graphics.getColor(); 
     graphics.setColor(Color.WHITESMOKE); 
     graphics.fillRect(0, 0, bip.getWidth(), bip.getHeight()); 
     graphics.setColor(c); 
     super.paintBackground(graphics); 
    } 

    protected void sublayout(int maxWidth, int maxHeight) { 
     int width = bip.getWidth(); 
     int height = bip.getHeight(); 
     super.sublayout(width, height); 
     setExtent(width, height); 
    } 
}; 

這裏的bip是一個大小爲290 * 220的位圖。我的屏幕尺寸是320 * 240。所以網格不覆蓋整個屏幕,但它的一部分。

+1

你以爲超越什麼意思?你必須滾動才能看到元素? – 8vius

+1

@arunabha:你的意思真的不清楚。在這種情況下,你有什麼和你想要的截圖是必須的。另外,爲了將來,請嘗試以適當的方式格式化您的文本/代碼(我們是這裏的人,而不是編譯器)。 –

回答

-1

使用GridFieldManager代替所有這一切,它是黑莓手機的一個不錯的選擇