本文介绍了支持多屏 - 黑莓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最初开发黑莓应用程序的,我也没太注意,能够支持多种屏幕分辨率。所以,我结束了与运行在320 * 240分辨率的罚款,但在其他屏幕完全打乱了code。

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*240 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?

谢谢,

Teja公司。

Thanks,
Teja.

推荐答案

一般试着做了几件事情:

Generally try to do a few things:


  1. 指定的点(使用Ui.UNITS_pt),而不是所有的像素的字体。 BlackBerry设备有巨大的差别的像素密度(任何地方从320 - 480相同的物理尺寸屏幕上),所以像素可看起来很渺小一个屏幕上,但在另一个太大。点将pretty大致相同的物理尺寸,无论你走到哪里。

  2. 相对于你的字体大小
  3. 缩放UI元素

  4. 如果您有图形元素(标识等)尽量凑合着用1或2个不同的尺寸(例如,一个有水平的分辨率和屏幕LT = 320像素,支持更大的屏幕分辨率)。有一个额外的设置在您的应用程序的图像将会使它有点大,但不会太大。不要依赖于大多数图像内置黑莓API中的缩放算法,他们是缓慢的,并产生可怕的妆效。

  5. 相对于屏幕边缘(例如附连到右上角或右下角,或从底部边缘10个像素),而不是使用绝对像素(或点)的位置的位置的事情。

  6. 找出在布局您的屏幕/域方法的所有屏幕尺寸。这种方法只被调用一次(或次极少数),所以任何计算密集型的东西可以安全地在那里进行。

  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.

还有最后一个提示:如果你有一个图形/ UI设计师,让他们为不同的分辨率至少做2-3样机。它会得到他们想参与过的挑战。

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.

这篇关于支持多屏 - 黑莓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:49