2012-06-18 60 views
0

我正在開發一款帶有預期目標OS5 +的黑莓應用程序。爲什麼列表的最後一行被刪減?

我正在創建一個GridFieldManager來顯示從Web服務中獲取的數據。第二列數據通常是多行的,所以我設置的行高度比標準高。這是我的GridFieldManager代碼:

//Creation and property settings 

GridFieldManager myGrid = new GridFieldManager(myScreenData.getSpese().size(), 3, GridFieldManager.USE_ALL_WIDTH|GridFieldManager.VERTICAL_SCROLL); 
     myGrid.setColumnProperty(0,GridFieldManager.AUTO_SIZE, Display.getWidth()/3); 
     myGrid.setColumnProperty(1,GridFieldManager.AUTO_SIZE, Display.getWidth()/3); 

     myGrid.setColumnProperty(2,GridFieldManager.AUTO_SIZE, Display.getWidth()/3); 
     myGrid.setRowPadding(3); 
     myGrid.setMargin(3,0,3,0); 
     for(int i=1;i<myScreenData.getSpese().size()-1;i++){ 
      myGrid.setRowProperty(i, GridFieldManager.FIXED_SIZE, getFont().getHeight()*3); 
     } 

//title population 
     myGrid.insert(new LabelField("DATA"), 0,FIELD_LEFT); 
     myGrid.insert(new LabelField("CAUSALE"), 1,FIELD_LEFT); 
     myGrid.insert(new LabelField("IMPORTO"), 2,FIELD_LEFT); 
//Data population  
     for (int i=0;i<myScreenData.getSpese().size()-1;i++){ 
      System.out.println("aggiungo "+i+" di "+(myScreenData.getSpese().size()-1)); 
      SpesaDateAsString mySpesa = (SpesaDateAsString)myScreenData.getSpese().elementAt(i); 
      myGrid.insert(new LabelField(mySpesa.getData(),LabelField.FIELD_LEFT|LabelField.FOCUSABLE),0+((i+1)*3),FIELD_LEFT); 
      myGrid.insert(new LabelField(mySpesa.getCausale(),LabelField.FIELD_LEFT|LabelField.FIELD_VCENTER),1+((i+1)*3),FIELD_LEFT); 
      myGrid.insert(new LabelField(mySpesa.getImporto(),LabelField.FIELD_LEFT),2+((i+1)*3),FIELD_LEFT); 


     } 
     System.out.println("aggiungo la tabella"); 
     result.add(myGrid); 

這裏的問題是,名單的最後一行被削減。下面是截圖:

blackberry storm simulator screenshot

有誰知道該怎麼辦?這是爲什麼發生?

我已經嘗試了行屬性(FIXED,AUTO,PREFERRED ... ETC)和填充和邊距的每種可能組合的參數的每種可能組合。有誰知道如何解決這個問題?

+0

哪裏是截圖? – Signare

+0

編輯,不知何故圖像鏈接不會顯示,所以我重新添加它。 – Th0rndike

回答

1

我認爲這個問題是在這一行:

for (int i=0;i<myScreenData.getSpese().size()-1;i++){ 

爲什麼你的極限是myScreenData.getSpese().size()-1和測試是嚴格<? 要麼你使用較少或相同的運營商或您的限制應該是myScreenData.getSpese().size()

+0

我現在就試試看。你可能走在正確的軌道上。 (seèquesto mi sparo!) – Th0rndike

+0

祝你好運! (Seèquesto prima di spararti accettami la risposta!:D) –

+0

不錯! (grazie mille,da giorni ci scombattevo!) – Th0rndike

相關問題