开发者

Increase the height widht of image as per BB screen size

I have written the following code to add image as a background to the BlackBerry screen.The image size is 320*240.The image is added to the screen but then I want to increase its height and width according to the size of the BB screen hei开发者_运维知识库ght and width.

Following is the code I have written:

Bitmap xtclogoBitmap = Bitmap.getBitmapResource("launch_xtc.jpg");
BitmapField xtcbitmapField = new BitmapField(xtclogoBitmap,Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH);
add(xtcbitmapField);

How can I increase the height and width of the image as per the BB screen size?


Bitmap img=Bitmap.getBitmapResource("3.jpg");
Bitmap bg = new Bitmap(Display.getWidth(), Display.getHeight());
img.scaleInto(bg,Bitmap.FILTER_LANCZOS, Bitmap.SCALE_TO_FILL);

you can replace Bitmap.SCALE_TO_FILL and/or modify the values of getheight and width by addition for example depending on your needs, then just add the bg

check this explanation from BlackBerry here

regards,

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜