开发者

Supporting multiple screens - Blackberry

When developing a blackberry app originally, I didn't pay much attention to being able to support multiple screen resolutions. So, I ended up with code that runs fine on a 320*开发者_如何学Go240 resolution but messes up completely on other screens.

How do I go about fixing this? Or in general, how would you support multiple resolutions without making one build for each res?

Thanks,

Teja.


Generally try to do a few things:

  1. Specify all your fonts in points (use Ui.UNITS_pt) rather than pixels. BlackBerry devices have hugely different pixel densities (anywhere from 320 - 480 on the same physical size screen) so pixels can look tiny on one screen but too big on another. Points will be pretty much the same physical size no matter where you go.
  2. Scale UI elements relative to your font sizes
  3. If you have graphical elements (logos, etc) try to make do with 1 or 2 different sizes (e.g. one for screens with horizontal resolutions <= 320 pixels, one for larger screen resolutions). Having one extra set of images in your app will make it a bit bigger, but not too much. Don't rely on the built-in scaling algorithms in the BlackBerry API, they're slow and produce terrible looking results for most images.
  4. Position things relative to the screen edges (e.g. attached to the top right, or bottom right corner, or 10 pixels from the bottom edge) rather than using absolute pixel (or point) positions.
  5. Figure out all your screen dimensions in the layout method of your screens/fields. This method should only be called once (or a very few number of times) so any computationally intensive stuff can safely be done there.

Really it's not bad if you keep a few things in mind - definitely easier to design this way from scratch than to fix up an app that's been designed for one resolution.

Also one last tip: if you have a graphic/UI designer, get them to do at least 2-3 mockups for different resolutions. It'll get them thinking about the challenges involved too.


The blackberry developer site has some good advice on how to go about doing this. It isn't the best way, but one option is to detect the device information and have the app use the correct implementation for the device it detects. The downside to this would be having to make the app multiple times and store all of them in the application, making it rather bloated unnecessarily. This could be avoided by providing different download links for different devices, or using some of the advice they list on the site here:

Designing and developing for different BlackBerry devices and software versions

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜