在我的黑莓应用程序中使用背景图片
答
final Bitmap header_Bitmap = //your image
VerticalFieldManager vfm_ = new VerticalFieldManager(
Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR
| Manager.NO_VERTICAL_SCROLL
| Manager.NO_VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH) {
public void paint(Graphics graphics) {
graphics.setBackgroundColor(0x040811);
graphics.clear();
graphics.drawBitmap(0, 0, header_Bitmap.getWidth(),
header_Bitmap.getHeight(), header_Bitmap, 0, 0);
super.paint(graphics);
}
};
add(vfm_);
答
背景,BackgroundFactory可以用来设置的任何VerticalFieldManager,HorizontalFieldManager或MainScreen的背景。从JDE版本4.6.0开始支持此支持。
检查API。
Bitmap bitmap = Bitmap.getBitmapResource("myBitmap.png");
Background background = BackgroundFactory.createBitmapBackground(bitmap);
setBackground(background);