嗨,朋友,我想通过使用多个标签字段在黑莓屏幕中显示几个数据。但是当我使用多个标签字段时,它不会垂直和水平滚动,所以请帮助我解决这个问题。
这是我的代码
public class Data extends MainScreen {
BGManager objManager = new BGManager();
public LabelField objTitle;
private VerticalFieldManager vfmMainManager;
private VerticalFieldManager vfmScrollManager;
private HorizontalFieldManager hfmUsernameManager;
private HorizontalFieldManager hfmPasswordManager;
private HorizontalFieldManager headerBar;
private ImageButton btn_Update;
private Bitmap[] img1;
private LabelField objLabelField;
public TaskListField objTaskListField;
public TextField objTextField = new TextField(TextField.TYPE_PLAIN, TextField.FIELD_HCENTER);
public String strIndex;
public LabelField objLabelField2, objLabelField3, objLabelField4, objLabelField5, objLabelField6, objLabelField7, objLabelField8, objLabelField9;
public LabelField objLabelField12, objLabelField13, objLabelField14, objLabelField15, objLabelField16, objLabelField17, objLabelField18, objLabelField19, objLabelField20;
public String strSerno, strDate, strAllo, strMob, strDetail, strRemark, strSldate, strEmail, strStatus;
public int curentIndex = 0;
public H_FieldManager objH_FieldManager1, objH_FieldManager2, objH_FieldManager3, objH_FieldManager4, objH_FieldManager5, objH_FieldManager6, objH_FieldManager7, objH_FieldManager8, objH_FieldManager9, objH_FieldManager10, objH_FieldManager11, objH_FieldManager12, objH_FieldManager13, objH_FieldManager14, objH_FieldManager15, objH_FieldManager16, objH_FieldManager17, objH_FieldManager18;
public Data(int index) {
super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLL_MASK);
objTitle = new LabelField("Details Page", LabelField.FIELD_HCENTER | LabelField.USE_ALL_WIDTH);
objTitle.setColor(Color.BLACK);
setTitle(objTitle);
this.add(objManager);
System.out.println("Index1 ==" + index);
this.curentIndex = index;
strSerno = XmlHander.vectSrno.elementAt(curentIndex).toString();
strDate = XmlHander.vectSrdate.elementAt(curentIndex).toString();
strAllo = XmlHander.vectAllo.elementAt(curentIndex).toString();
strMob = XmlHander.vectMob.elementAt(curentIndex).toString();
strDetail = XmlHander.vectDetails.elementAt(curentIndex).toString();
strRemark = XmlHander.vectRemark.elementAt(curentIndex).toString();
strSldate = XmlHander.vectSldate.elementAt(curentIndex).toString();
strEmail = XmlHander.vectEmail.elementAt(curentIndex).toString();
strStatus = XmlHander.vectStatus.elementAt(curentIndex).toString();
img1 = new Bitmap[3];
img1[0] = Bitmap.getBitmapResource("btn-hover.png");
img1[1] = Bitmap.getBitmapResource("btn.png");
img1[2] = Bitmap.getBitmapResource("btn.png");
btn_Update = new ImageButton(img1, "Update", ImageButton.FIELD_LEFT);
btn_Update.setColor(Color.WHITE);
hfm12 = new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER);
hfm12.add(btn_Update);
objLabelField12 = new LabelField("SRNo : ");
objLabelField12.setColor(Color.BLACK);
objLabelField13 = new LabelField("SRDate : ");
objLabelField13.setColor(Color.BLACK);
objLabelField14 = new LabelField("AllocationDate : ");
objLabelField14.setColor(Color.BLACK);
objLabelField15 = new LabelField("MobileNumber : ");
objLabelField15.setColor(Color.BLACK);
objLabelField16 = new LabelField("SRDetails : ");
objLabelField16.setColor(Color.BLACK);
objLabelField17 = new LabelField("Remarks : ");
objLabelField17.setColor(Color.BLACK);
objLabelField18 = new LabelField("SLADate : ");
objLabelField18.setColor(Color.BLACK);
objLabelField19 = new LabelField("Email : ");
objLabelField19.setColor(Color.BLACK);
objLabelField20 = new LabelField("CaseStatus : ");
objLabelField20.setColor(Color.BLACK);
objLabelField = new LabelField(strSerno);
objLabelField.setColor(Color.BLACK);
objLabelField2 = new LabelField(strDate);
objLabelField2.setColor(Color.BLACK);
objLabelField3 = new LabelField(strAllo);
objLabelField3.setColor(Color.BLACK);
objLabelField4 = new LabelField(strMob);
objLabelField4.setColor(Color.BLACK);
objLabelField5 = new LabelField(strDetail);
objLabelField5.setColor(Color.BLACK);
objLabelField6 = new LabelField(strRemark);
objLabelField6.setColor(Color.BLACK);
objLabelField7 = new LabelField(strSldate);
objLabelField7.setColor(Color.BLACK);
objLabelField8 = new LabelField(strEmail);
objLabelField8.setColor(Color.BLACK);
objLabelField9 = new LabelField(strStatus);
objLabelField9.setColor(Color.BLACK);
objTextField = new TextField(TextField.TYPE_PLAIN, TextField.FIELD_HCENTER);
objTextField.setText(strMob);
// hfm11=new VerticalFieldManager();
// hfm11.add(objTextField);
hfm10 = new VerticalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.USE_ALL_HEIGHT | MainScreen.HORIZONTAL_SCROLL | MainScreen.VERTICAL_SCROLL);
hfm1 = new VerticalFieldManager(HorizontalFieldManager.FIELD_HCENTER);
// hfm1.add(objLabelField);
// hfm2=new VerticalFieldManager(HorizontalFieldManager.FIELD_HCENTER|VerticalFieldManager.VERTICAL_SCROLL);
// hfm2.add(objLabelField2);
// hfm3=new VerticalFieldManager(HorizontalFieldManager.FIELD_HCENTER|VerticalFieldManager.VERTICAL_SCROLL);
// hfm3.add(objLabelField3);
// hfm4=new VerticalFieldManager(HorizontalFieldManager.FIELD_HCENTER|VerticalFieldManager.VERTICAL_SCROLL);
// hfm4.add(objLabelField4);
// hfm5=new VerticalFieldManager(HorizontalFieldManager.FIELD_HCENTER|VerticalFieldManager.VERTICAL_SCROLL);
// hfm5.add(objLabelField5);
// hfm6=new VerticalFieldManager(HorizontalFieldManager.FIELD_HCENTER|VerticalFieldManager.VERTICAL_SCROLL);
// hfm6.add(objLabelField6);
// hfm7=new VerticalFieldManager(HorizontalFieldManager.FIELD_HCENTER|VerticalFieldManager.VERTICAL_SCROLL);
// hfm7.add(objLabelField7);
// hfm8=new VerticalFieldManager(HorizontalFieldManager.FIELD_HCENTER|VerticalFieldManager.VERTICAL_SCROLL|VerticalFieldManager.USE_ALL_HEIGHT);
// hfm8.add(objLabelField8);
// hfm9=new VerticalFieldManager(HorizontalFieldManager.FIELD_HCENTER|VerticalFieldManager.VERTICAL_SCROLL);
// hfm9.add(objLabelField9);
objH_FieldManager1 = new H_FieldManager(objLabelField12, objLabelField, true);
objH_FieldManager2 = new H_FieldManager(objLabelField13, objLabelField2, true);
objH_FieldManager3 = new H_FieldManager(objLabelField14, objLabelField3, true);
objH_FieldManager4 = new H_FieldManager(objLabelField15, objLabelField4, true);
objH_FieldManager5 = new H_FieldManager(objLabelField16, objLabelField5, true);
objH_FieldManager6 = new H_FieldManager(objLabelField17, objLabelField6, true);
objH_FieldManager7 = new H_FieldManager(objLabelField18, objLabelField7, true);
objH_FieldManager8 = new H_FieldManager(objLabelField19, objLabelField8, true);
objH_FieldManager9 = new H_FieldManager(objLabelField20, objLabelField9, true);
objManager.add(objH_FieldManager1);
objManager.add(objH_FieldManager2);
objManager.add(objH_FieldManager3);
objManager.add(objH_FieldManager4);
objManager.add(objH_FieldManager5);
objManager.add(objH_FieldManager6);
objManager.add(objH_FieldManager7);
objManager.add(objH_FieldManager8);
objManager.add(objH_FieldManager9);
objManager.add(hfm12);
objManager.add(hfm10);
// add(objTextField);
// this.add(mgr);
}
}
在此代码中,我使用了几个标签归档,例如
objLabelField12=new LabelField("SRNo : ");
标签字段的这个典型想要水平显示,这是垂直的
objLabelField=new LabelField(strSerno);
我想水平和垂直滚动两侧。
请帮助我。
尝试将标签字段设置为可聚焦。
objLabelField = new LabelField("Text", Field.FOCUSABLE |LabelField.FIELD_HCENTER |LabelField.USE_ALL_WIDTH)