开发者

Blackberry: Text too small when put on actual device

开发者 https://www.devze.com 2023-04-01 07:26 出处:网络
I used the 9330 simulator for de开发者_Python百科veloping my app, and now once I put it on a blackberry bold, I\'ve noticed that my text and images appear much smaller on the device than the simulator

I used the 9330 simulator for de开发者_Python百科veloping my app, and now once I put it on a blackberry bold, I've noticed that my text and images appear much smaller on the device than the simulator. Is there anyway to fix this without having to change every objects height and width? Maybe I need to use Display.getHeight() and .getWidth() more instead of hardcoding numbers?


One way I dealt with this is making the size of my elements variable. I did this by, upon loading the app, detecting the screen size and applying a multiplier that modifies my elements by a given %, the % depends on the screen size. I calculated these percentages by taking a base screen size and seeing how much the screen sized varied from one model to another, there are only 4 screen sizes I believe.


Yes, you shouldn't hardcode any number as bold and curve have differnt screen resolutions

Curve: 8800s, 8300s, 8500s, 9300s 320x240

Bold: 8900s, 9000s, 9600s, 9700s 480x360, 480x320 (Bold 9000)

You will have to change every place you used that numbers and change to gethHeight and getWidth() where needed


For the images you should scale the object, something like this:

Bitmap bitmap = new Bitmap(width, height);
yourBitmap.scaleInto(bitmap, Bitmap.FILTER_BILINEAR);

For texts you should use something like this:

LabelField field = new LabelField("TEST");
field.setFont(field.getFont().derive(Font.PLAIN, yourFontSize));
0

精彩评论

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