2010-10-21 109 views
0

我想使ObjectChoice字段具有固定的長度。但默認情況下,ObjectChoice長度基於內容長度。黑莓中的對象選擇字段

例如,如果內容是「選擇1」,「選擇選擇1」,則ObjectChoice字段將根據所選選項採用不同的長度。

回答

2

使用此樣本/例如:

String choices[] = {"0","1","2","3","4"}; 

ObjectChoiceField choice1 = new ObjectChoiceField("", choices, ""){   
    public void layout(int width, int height){ 
     width = 80; 
     super.layout(getWidth(), getHeight()); 
     super.layout(width, height); 
     setExtent(width, super.getHeight()); 
    } 
};