文档详情

Blackberry contents.ppt

发布:2015-09-25约4.23千字共14页下载文档
文本预览下载声明
Blackberry培训 UI布局之继承结构 UI布局之Field net.rim.device.api.ui.Field直接继承自java.lang.Object为页面布局元素。 直接继承自Field的子类为: MapField,Manager,BitmapField,ButtonField,CheckboxField, ChoiceField,DateField,GaugeField,LabelField,ListField, NullField,RadioButtonField,SeparatorField,SpinBoxField, TextField,TreeField,PictureScrollField 以上皆为可使用的直接布局元素。 UI布局之MainScreen MainScreen继承自Screen,顾名思义,为可显示的界面。一个App可以有多个MainScreen。独立界面继承自MainScreen类,亦可直接继承自Screen。 独立界面之间的切换使用pop方法和push方法: UiApplication.getUiApplication().popScreen(要关闭的界面) UiApplication.getUiApplication().pushScreen(要显示的界面) 如:public class LoginScreen extends MainScreen(){} UI布局之Manager 使用BlackBerry API布局管理器来安排屏幕上的组件。 下面四个类扩展了Manager类,以提供预定义的布局管理器: VerticalFieldManager垂直布局管理器 HorizontalFieldManager水平布局管理器 DialogFieldManager弹出式对话框布局管理器 如:VerticalFieldManager vfm =?new VerticalFieldManager(Manager.VERTICAL_SCROLL); vfm.add(bitmapField); vfm.add(bitmapField2); ... mainScreen.add(vfm) UI布局之Dialog public Dialog(String?message, Object[]?choices, int[]?values, int?defaultChoice, Bitmap?bitmap) Constructs a new Dialog instance. Parameters: message - Message to display in the dialog. choices - Objects selectable by the user. Each object is displayed using Object to String() values - If this parameter is specified, instead of returning the index selected, Dialog.doModal() returns the value associated with this index (useful for adding Dialog.CANCEL). defaultChoice - Initial choice selected when the Dialog is displayed. If you provide a non-null values parameter, the default choice must be present in the values array. If the values parameter is null, the default choice is the index of the initially selected item. bitmap - Image to display in the left side of the dialog. Blackberry控件特性 界面元素需要自定义实现时,必须重写方法: protected void layout(int width, int height) { super.la
显示全部
相似文档