将图像调整到黑莓屏幕

时间:2011-09-15 09:17:47

标签: blackberry

如何在BlackBerry模拟器上安装大图像,以便整个图像显示而不会被裁剪?任何人都可以帮助我使用代码示例

1 个答案:

答案 0 :(得分:2)

有很多方法可以做到这一点但是如果它符合你的要求那么backgroundfactory很好。 http://www.blackberry.com/developers/docs/4.6.0api/net/rim/device/api/ui/decor/BackgroundFactory.html

// specify the bitmap and xy positioning to meet your needs
Background background = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("bitmap.png"),Background.POSITION_X_LEFT, Background.POSITION_Y_BOTTOM, Background.REPEAT_NONE);

// create a field manager and set its BG to this one
VerticalFieldManager body = new VerticalFieldManager(USE_ALL_WIDTH|USE_ALL_HEIGHT);
body.setBackground(background);
add(body);

//Some other options
//Background.REPEAT_NONE
//Background.REPEAT_SCALE_TO_FIT
//Background.REPEAT_VERTICAL
//Background.REPEAT_HORIZONTAL