如何在黑莓中的第三个垂直字段管理器上添加2个垂直字段管理器?

时间:2011-11-15 12:11:59

标签: blackberry

enter image description here

嗨,请告诉我如何在黑莓手机中制作这个屏幕。 我的数据没有添加到它上。我使用垂直字段管理器添加所有组件。

2 个答案:

答案 0 :(得分:1)

它的工作..我为你创造了它。使用此代码

public class home extends UiApplication {

public static void main(String[] args)
{
    home app = new home();
    app.enterEventDispatcher();
}

MainScreen screen = new MainScreen();
private int deviceWidth = Display.getWidth();
private int deviceHeight = Display.getHeight();
LabelField lbl1 = new LabelField("label");
final Bitmap backgroundBitmap = Bitmap.getBitmapResource("bg1.jpg");
final Bitmap backgroundBitmap1 = Bitmap.getBitmapResource("bg2.jpg");
final BitmapField mybitmapField = new BitmapField(Bitmap.getBitmapResource("facebook-logo.jpg"),DrawStyle.HCENTER);

public home()
{
    super();
    pushScreen(screen);

    VerticalFieldManager mainManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR )
        {          
            public void paint(Graphics graphics)
            {
                graphics.clear();
                graphics.drawBitmap(0, 0, deviceWidth, deviceHeight, backgroundBitmap, 0, 0);                       
                super.paint(graphics);
            }            
        };
      //this manger is used for adding the componentes
    VerticalFieldManager subManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR )
        {
            public void paint(Graphics graphics)
            {
                graphics.clear();
                graphics.drawBitmap(0, 0, deviceWidth, deviceHeight, backgroundBitmap1, 0, 0);                       
                super.paint(graphics);
            }   
        };

        screen.add(mainManager);
        mainManager.add(lbl1);
        mainManager.add(subManager);

        subManager.add(mybitmapField);
        subManager.add(new LabelField("Data 1"));
        subManager.add(new LabelField("Data 1"));
        subManager.add(new LabelField("Data 1"));
}   
}

输出将是这样的。 enter image description here

答案 1 :(得分:0)

在下面找到如何制作此屏幕的示例:

    VerticalFieldManager manager = new VerticalFieldManager();
    VerticalFieldManager first = new VerticalFieldManager();
    VerticalFieldManager second = new VerticalFieldManager();

    first.add(label);
    second.add(image);
    second.add(data);
    second.add(data);
    second.add(data);

    manager.add(first);
    manager.add(second);
    add(manager);