0
searchlist = new FileList(list_vector,ind,j);//a custom list field 
searchlist.setRowHeight(40); 
searchListManager = new VerticalFieldManager(
    Manager.VERTICAL_SCROLL |Manager.VERTICAL_SCROLLBAR) 

searchListManager.add(searchlist); 
objManager.add(searchListManager); 
HomeScreen1.this.add(header_manager); 
HomeScreen1.this.add(objManager); 

//after few lines of code 
button_manager.add(Previous); 
button_manager.add(Next); 
objManager.add(button_manager); 

我現在的問題是,當我滾動在列表字段,然後接下來的n以前是不可見的 但是當我按下鍵了N個了,然後他們獲得唯一可見黑莓Storm - 焦點不會亮起滾動列表字段後增加focussable領域

做什麼???????????

回答

1

嘗試實施searchListManager當作滾動VerticalManager固定大小(顯示高度 - 頭部經理高度 - 按鈕經理高)

UPDATE代碼嘗試:

class Scr extends MainScreen implements ListFieldCallback { 
    int DISPLAY_WIDTH = Display.getWidth(); 
    int DISPLAY_HEIGHT = Display.getHeight(); 
    Vector mItems = new Vector(); 
    ListField mListField = new ListField(); 
    SizedVFM mListManager = new SizedVFM(DISPLAY_WIDTH, DISPLAY_HEIGHT - 50); 

    ButtonField mPrevButtonField = new ButtonField("Previous", 
      ButtonField.CONSUME_CLICK); 
    ButtonField mNextButtonField = new ButtonField("Next", 
      ButtonField.CONSUME_CLICK); 

    HorizontalFieldManager mButtonsManager = new HorizontalFieldManager(
      FIELD_HCENTER); 

    public Scr() { 
     for (int i = 1; i < 31; i++) { 
      mItems.addElement("item " + String.valueOf(i)); 
     } 

     mListField.setCallback(this); 
     mListField.setSize(30); 
     add(mListManager); 
     mListManager.add(mListField); 

     mPrevButtonField.setChangeListener(new FieldChangeListener() { 
      public void fieldChanged(Field field, int context) { 
       Dialog.inform("Previouse pressed"); 
      } 
     }); 

     mNextButtonField.setChangeListener(new FieldChangeListener() { 
      public void fieldChanged(Field field, int context) { 
       Dialog.inform("Next pressed"); 
      } 
     }); 

     mButtonsManager.add(mPrevButtonField); 
     mButtonsManager.add(mNextButtonField); 
     add(mButtonsManager); 
    } 

    public void drawListRow(ListField field, Graphics g, int i, int y, int w) { 
     // Draw the text. 
     String text = (String) get(field, i); 
     g.drawText(text, 0, y, 0, w); 
    } 

    public Object get(ListField listField, int index) { 
     return mItems.elementAt(index); 
    } 

    public int getPreferredWidth(ListField listField) { 
     return DISPLAY_WIDTH; 
    } 

    public int indexOfList(ListField listField, String prefix, int start) { 
     return 0; 
    } 
} 

class SizedVFM extends VerticalFieldManager { 
    int mWidth; 
    int mHeight; 

    public SizedVFM(int width, int height) { 
     super(VERTICAL_SCROLL | VERTICAL_SCROLLBAR); 
     mWidth = width; 
     mHeight = height; 
    } 

    public int getPreferredHeight() { 
     return mHeight; 
    } 

    public int getPreferredWidth() { 
     return mWidth; 
    } 

    public void setHeight(int height) { 
     mHeight = height; 
    } 

    protected void sublayout(int maxWidth, int maxHeight) { 
     super.sublayout(maxWidth, maxHeight); 
     setExtent(getPreferredWidth(), getPreferredHeight()); 
    } 
} 

而且結果應該是這樣的:
alt text http://img215.imageshack.us/img215/1402/9530list.jpg

+0

它不工作!!!!!!!!! – Swati 2010-03-10 12:33:47

+0

現在應該工作;) – 2010-03-10 13:49:12

+0

感謝它workrd設備上而不是在模擬器 – Swati 2010-03-11 07:28:17