我已经开发了屏幕分辨率为320x240的BlackBerry应用程序。现在我需要它来支持多分辨率的屏幕。我在哪里存储不同分辨率的图像,并通过代码相应地访问它们,而不需要为每个屏幕分辨率单独构建?
如果可能,请为我提供各种屏幕尺寸的BlackBerry,这需要被移植。
发布于 2012-05-08 19:13:27
不同的屏幕分辨率是-
240 x 240 7730
240 x 320 8220 8230
320 x 240 8520 9300 9330 8310 8530 8830 8320 8330 8700c 8820 8800 8300 8707v 8330 8500
curve3G 9220
360 x 400 9670 9105 9100 pearl3G
360 x 480 9800 9500 9370 9350 9780 9520 9550 9530 9670
480 x 320 9000
480 x 360 9650 9700 9630 8900 9360
480 x 800 9860 9850 storm3 volt
640 x 480 Bold 9900
int device_h = Display.getHeight();
int device_w = Display.getWidth();
if(device_h==240 && device_w== 320 ){
//select image of that size
}
else if(device_h==480 && device_w== 360){
//select image of that size
} and so on.....将不同的图像存储在项目的res文件夹中的单独文件夹中。
发布于 2012-05-09 20:17:56
是的,这不会增加项目的规模吗?我发现您可以存储分辨率良好的图像,并使用以下代码根据设备大小进行缩放
int barW = Fixed32.div(Fixed32.toFP(bitmap.getWidth()), Fixed32.toFP(scaleW));
int barH = Fixed32.div( Fixed32.toFP(bitmap.getHeight()), Fixed32.toFP(scaleH));
Bitmap scaledBitmap =
EncodedImage.getEncodedImageResource(img).scaleImage32(barW, barH).getBitmap();这似乎也很好用:)
https://stackoverflow.com/questions/10497340
复制相似问题