Q
背景图像黑莓图像
1
A
回答
2
这里是我如何做到这一点:
这个工作在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或更早的版本,我使用布局管理器,只需像添加其他图像一样添加背景图片,但首先添加背景图片以便底部绘制。
就像我说的,我会尝试找到布局管理器的教程。
1
您可以创建扩展Manager类 在这里,您可以指定背景图片,以及你可以在一个位置定位等图像类,你要
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);
}
}
相关问题
- 1. 在背景图像背景图像
- 2. 如何设置按钮的图像背景黑莓
- 3. 更改主屏幕背景图像的黑莓API
- 4. 背景图像滚动禁用黑莓主领域管理器
- 5. 如何将图像设置为黑莓背景
- 6. 黑莓优化 - 从磁盘或内存背景图像?
- 7. 黑莓 - 设置字段背景图像大小适合
- 8. 黑莓:WebBitmapField中心图像
- 9. 负荷图像黑莓
- 10. 黑莓图像处理
- 11. 黑莓显示图像
- 12. 黑莓图像加载器
- 13. 黑莓 - 裁剪图像
- 14. ObjectListField与图像黑莓JDE
- 15. 黑莓图像效果
- 16. 图像识别黑莓
- 17. 背景图像黑暗还是光线?
- 18. 给图像一个黑色的背景?
- 19. PyQt透明背景图像部分黑
- 20. 图像背景
- 21. 背景图像
- 22. 背景图像
- 23. Magento如何删除图像背景中的黑色图像
- 24. iOS:背景图像黑色而不是请求的图像?
- 25. 让在黑色背景的图像发光的图像
- 26. 镜像黑莓中的图像
- 27. 背景图片上的背景图像
- 28. 背景图像css
- 29. SVG背景图像
- 30. 背景图像tamplete
感谢很多示例代码。 m等待教程,因为我正在开发应用程序在4.5.0版本 – Master 2010-03-10 13:00:01
这里是一个:http://docs.blackberry.com/en/developers/deliverables/1180/development.pdf#24 这是在第24页的pdf。 整个手册是从4.5.0,所以它应该都适合你。 – 2010-03-10 14:56:17