【问题标题】:Increase the height widht of image as per BB screen size根据BB屏幕尺寸增加图像的高度宽度
【发布时间】:2010-12-17 03:58:00
【问题描述】:

我编写了以下代码将图像作为背景添加到 BlackBerry 屏幕。图像大小为 320*240。图像被添加到屏幕但我想根据大小增加它的高度和宽度BB 屏幕的高度和宽度。

以下是我写的代码:

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

如何根据BB屏幕尺寸增加图像的高度和宽度?

【问题讨论】:

标签: image blackberry image-processing


【解决方案1】:
Bitmap img=Bitmap.getBitmapResource("3.jpg");
Bitmap bg = new Bitmap(Display.getWidth(), Display.getHeight());
img.scaleInto(bg,Bitmap.FILTER_LANCZOS, Bitmap.SCALE_TO_FILL);

您可以根据需要替换 Bitmap.SCALE_TO_FILL 和/或通过添加来修改 getheight 和 width 的值,然后只需添加 bg

查看来自 BlackBerry here 的解释

问候,

【讨论】:

    猜你喜欢
    • 2014-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-15
    相关资源
    最近更新 更多