Design for multiple screen sizes on BlackBerry

Android and iOS have the concept of "pixel density independent", so your layouts look the same on devices with different densities and screen sizes.

So far I have written code for space elements manually using pixels (i.e. I want this button to be 10 pixels on the left side of the screen). This is great on the curve, but when I load it in bold, the resolution is much higher, so 10 pixels is much less physical space.

What are the best practices for multiple screen sizes on your BlackBerry? Is there an easy way to determine a density independent pixel? RIM does not seem to offer much in terms of documentation or APIs to make this easy.

+4
source share
1 answer

Dots are pixels independent of density (with a high degree of accuracy).

For BlackBerry, the most suitable class is net.rim.device.api.ui.Ui , which defines the UNITS_pt constant (and the UNITS_px constant), the convertSize method for converting between points and pixels (since operations on Graphics take pixels instead of points).

A useful methodology for BlackBerry applications is everything related to your font sizes, which you define in points - there is a version of net.rim.device.api.ui.Font.derive that accepts a units parameter and makes it easy to get fonts with a certain point size .

Of course, you cannot take for granted - defining things in points will simplify the situation, but with BlackBerry you are dealing with many different pixel densities and proportions, so check carefully, at least on simulators.

+6
source

All Articles