Blackberry 黑莓手机背景图像上的图像

Blackberry 黑莓手机背景图像上的图像,blackberry,blackberry-eclipse-plugin,Blackberry,Blackberry Eclipse Plugin,我想设置一个图像在背景图像上的位置。位置可以在屏幕上的任何位置 可以给我一个示例代码、链接或教程吗?我是这样做的: 这在4.6.0及更高版本中有效,因为BackgroundFactory // Create the background image and the image field to put on top Background bg = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource(bgImgPath

我想设置一个图像在背景图像上的位置。位置可以在屏幕上的任何位置

可以给我一个示例代码、链接或教程吗?

我是这样做的:

这在4.6.0及更高版本中有效,因为BackgroundFactory

// Create the background image and the image field to put on top
Background bg = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource(bgImgPath);
Bitmap bmp = Bitmap.getBitmapResource(imgPath);
BitmapField imgField = new BitmapField(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);
对于多个图像,您可以创建一个布局管理器类,并使用类似的技术将所有图像定位到您想要的位置。这里有一个制作和使用布局管理器的教程,我会尝试把它挖出来,然后把它放回这里

如果您使用的是4.5.0或更早版本,我使用布局管理器,只需像添加其他图像一样添加背景图像,但首先添加它,以便在底部绘制


正如我所说,我将尝试查找布局管理器的教程。

您可以创建一个扩展管理器类的类 在这里,您可以指定背景图像,也可以将其他图像定位到所需的位置

class Test extends MainScreen
 {
   Test()
    {
      super();
      Bitmap bmp = Bitmap.getBitmapResource("image1.png");
      BitmapField bmpf = new BitmapField(bmp);
      Mymanager obj = new Mymanager();
      obj.add(bmpf);
    }
 }

class Mymanager extends Manager
{
final Bitmap background = Bitmap.getBitmapResource("back.png");
  protected void paint(Graphics g)
   {
     g.drawrect(0,0,background.getWidth,background.getheight,background,0,0);
   }
  protected void sublayout(int width, int height)
  {
    Field field = getfield(0);
    layoutchild(field,100,100);
    setPositionchild(field,20,10);  

    setExtent(Display.getWidth,Display.getHeight);
  }
}

非常感谢您提供的示例代码。我正在4.5.0版本上开发应用程序,正在等待教程。这里有一个:它在pdf的第24页。整个手册都是4.5.0版的,所以应该适合您。