如何在黑莓中创建自定义管理器

时间:2012-05-09 09:42:22

标签: blackberry

我正在寻找黑莓中的自定义管理器,它连续使用5个不同的字段。所有领域都应该是互动的。我已经粘贴了我想要使用黑莓5.0 SDK实现的图像。请帮助开始

enter image description here

1 个答案:

答案 0 :(得分:0)

我试过这样的事情 - enter image description here

请尝试以下代码 -

    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;


public class scree_align extends MainScreen{

public scree_align(){

    HorizontalFieldManager hfm_main=new HorizontalFieldManager();/*{
         protected void sublayout(int maxWidth, int maxHeight) 
          { 
              super.sublayout(Display.getWidth(),200); setExtent(Display.getWidth(),200);
          }
      };*/

    HorizontalFieldManager hfm_1=new HorizontalFieldManager();
    final Bitmap back = Bitmap.getBitmapResource("image.png");
    hfm_1.add(new BitmapField(back));
    hfm_1.setMargin(5,5,0,0);

    VerticalFieldManager vfm_1=new VerticalFieldManager();
    ButtonField btn1=new ButtonField("Button1");
    ButtonField btn2=new ButtonField("Button1");
    vfm_1.add(btn1);
    vfm_1.add(btn2);


    VerticalFieldManager vfm_2=new VerticalFieldManager();
    ButtonField btn3=new ButtonField("Button2");
    ButtonField btn4=new ButtonField("Button2");
    vfm_2.add(btn3);
    vfm_2.add(btn4);


    HorizontalFieldManager hfm_2=new HorizontalFieldManager();
    LabelField lab=new LabelField("Text");
    hfm_2.add(lab);
    hfm_2.setMargin(30,0,0,5);

    hfm_main.add(hfm_1);
    hfm_main.add(vfm_1);
    hfm_main.add(vfm_2);
    hfm_main.add(hfm_2);

    add(hfm_main);

}

}