我想將字段和按鈕添加到BlackBerry PopupScreen。將字段添加到BlackBerry PopupScreen
1
A
回答
1
您想自定義彈出屏幕這樣
public class CustomPopUpScreen extends PopupScreen {
public CustomPopUpScreen() {
super(new VerticalFieldManager(CustomPopUpScreen.NO_HORIZONTAL_SCROLL));
add(new ButtonField());
add(new ButtonField());
}
}
此代碼將幫助您
1
在這裏,我創建PopupScreen
類型的對象,並調用該方法givePopup
:
PopupScreen popup1=givePopup();
PopupScreen givePopup(){
VerticalFieldManager popvfm =new VerticalFieldManager();
ButtonField ok=new ButtonField("ok");
ButtonField cancel=new ButtonField("cancel");
popvfm.add(ok);
popvfm.add(cancel);
PopupScreen popup=new PopupScreen(popvfm);
return popup;
}
這種方法返回一個具有一個垂直字段管理器的實例,並在此管理器上添加兩個按鈕字段。
1
public class FriendPopupScreen extends MainScreen{
int dialogWidth;
int dialogHeight;
LabelField lblTitle;
HorizontalFieldManager hfmTitle;
Vector data;
public FriendPopupScreen() {
dialogWidth = 300;
dialogHeight = 150;
lblTitle = newLabelField("Choose option");
hfmTitle = new HorizontalFieldManager(USE_ALL_WIDTH){
protected void sublayout(int maxWidth, int maxHeight) {
// TODO Auto-generated method stub
maxWidth= Display.getWidth();
maxHeight=40;
super.sublayout(maxWidth, maxHeight);
setExtent(maxWidth, maxHeight);
}
protected void paint(Graphics graphics) {
// TODO Auto-generated method stub
graphics.setBackgroundColor(Color.BLACK);
graphics.clear();
super.paint(graphics);
}
};
hfmTitle.add(lblTitle);
lblTitle.setMargin(10,0,0,10);
add(hfmTitle);
}
protected void sublayout(int width, int height) {
setExtent(dialogWidth, dialogHeight);
setPosition(Display.getWidth()/2-(dialogWidth/2), Display.getHeight()/2 - (dialogHeight/2));
layoutDelegate(dialogWidth, dialogHeight);
}
}
並稱之爲:
FriendPopupScreen popup = new FriendPopupScreen();
UiApplication.getUiApplication().pushModalScreen(popup);
相關問題
- 1. blackberry - 將字段添加到屏幕
- 2. 無法將字段添加到管理器或BlackBerry的屏幕
- 3. 將收聽者添加到BlackBerry的列表字段中
- 4. dynamodb - 將字段添加到字段
- 5. 將字段添加到JSON
- 6. PopUpScreen Blackberry中的屏蔽事件
- 7. blackberry在列表字段中添加搜索字段
- 8. 將標記添加到BlackBerry地圖
- 9. 將標籤添加到BlackBerry ListField
- 10. Blackberry - 如何將邊框添加到BasicEditField?
- 11. 將字段添加到字典項目
- 12. BlackBerry - 如何將clickEvent(setChangeListener)添加到BlackBerry中的ListField?
- 13. 如何將blackberry庫添加到blackberry-eclipse-plugin項目中?
- 14. phpmyadmin將文本添加到字段
- 15. 將字段添加到網站模型
- 16. 將額外的字段添加到fullcalendar
- 17. 將值添加到輸入字段中
- 18. 將新字段添加到Bond模式
- 19. phpmyadmin將文本添加到空字段?
- 20. 將字段添加到PHP表格
- 21. 將其他字段添加到mysql
- 22. 將字段值添加到文本框
- 23. 將「幫助」消息添加到字段
- 24. Magento - 將字段添加到sales_flat_quote
- 25. 將更多字段添加到CreateUserWizard
- 26. 如何將字段添加到namedtuple?
- 27. Openbravo:將字段添加到窗口
- 28. 將動態字段添加到Uploadify
- 29. 將字段值添加到javascript函數
- 30. 將字段添加到雄辯ORM