开发者

How to I fix the background image to line up? (Blackberry)

开发者 https://www.devze.com 2023-03-23 07:23 出处:网络
I used some code that I found from another question. I commented out the setPositionChild() part because I wasn\'t sure what values to put for positionY and positionX. When I run the app, the backgrou

I used some code that I found from another question. I commented out the setPositionChild() part because I wasn't sure what values to put for positionY and positionX. When I run the app, the background image is on the top and the buttons that I add to the manager later are all pushed together at the bottom of the image.

    Background bg = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("Background.JPG"));
    Bitmap bmp = Bitmap.getBitmapResource("Background.JPG");
    BitmapField imgField = new BitmapField(开发者_Go百科bmp);
    // Create the field manager
    VerticalFieldManager manager = new VerticalFieldManager()
    {
      // Overide the sublayout of the field manager to set the position of
      // the image directly
    /*  protected void sublayout(int width, int height)
      {
         setPositionChild(imgField, positionX, positionY)
         setExtent(width, height)
      }*/
    };
    // Set the background of the field manager
    manager.setBackground(bg);
    // add the bitmap field to the field manager
    manager.add(imgField);
    // add the field manager to the screen
    add(manager);


Please mention what you are trying to achieve here. What's your expected behavior? Looking at code, the child fields should be positioned as you have mentioned when you run app. Since you are adding BitmapField (imageField) to manager and then probably adding buttons(not shown in code, assuming you are adding it somewhere else in code) to the manager. So provide more details on what you want to achieve?

0

精彩评论

暂无评论...
验证码 换一张
取 消