tags:

views:

962

answers:

3

We are writing an application for the T-Mobile MyTouch which is an Android based mobile phone. We have images that will be displayed on the default screen portrait mode (320 x 480).

Anticipating that the Android OS will be appearing on Netbooks with default landscape 16 : 9 screen format, what is the best way to handle images that are in a portrait mode format? In other words since you can't rotate the screen on these Netbooks, if you display a portrait mode image on landscape mode screen there will be large blank rectangles on either side of the image.

+2  A: 

In terms of image resources within the application, such as is the case with background images, it is a common practice to have different image set for landscape and portrait mode, or even different screen sizes. Surely, you will adapt your layout to it, or at least have a good relative layout.

However, if you are wondering what to do when an image of an unknown size has to be drawn on the screen (e.g. in case of photo album application), it is fine to leave those black rectangles on both sides. Take a look at the behaviour of video player view on the Android Dev Phone 1. It will adapt the video frame height to landscape mode, and it will play the video in the landscape mode whether or not a portrait mode is more suitable.

MannyNS
I understand that having different image sizes is a typical solution its not a good one because you have way too many images to manage. Make a change and you have to update all your sets. Scaling if possible is a better solution. Thank you for the observation about the Android video player view, that helps answer my concern.
goofy166
A: 

You should design your screen with certain anchor points and then position the rest of the views in relation to those anchor points. For example if you have a screen layout which has a banner, a list of items and some buttons under the list then 2 of the ways these can be positioned on the screen:

  1. Place banner at the top. Put the list under it and then the buttons under the list.
  2. Place banner at the top. Place the buttons at the bottom of the screen and then the list takes the space between the banner and the buttons.

Layout 1) will have trouble with different screen sizes and the layout will look odd or may not appear correctly at all. Whereas, 2) gives you a better appearance for most screen sizes.

Prashast
+3  A: 

You deal with it the same way you would deal with the user turning their phone sideways. This is as much a presentation decision as a UI one.

Remember Android supports using alternative layouts for identical Views. If you have a portrait layout e.g. res/layout/gallery.xml, you can create a landscape equivalent in res/layout-land/gallery.xml and Android will automatically load the latter layout file if the Activity is launched in landscape mode.

With the separate layout XML file, you can then arrange your image as you feel best fits the intent of your application (an application displaying medical images may well have different presentation priorities than one displaying a family portrait). You could for example just fill the background with a gradient, or more information that is otherwise hidden in portrait mode. It all depends on what you wish to achieve with your application and the lengths you are willing to go to to account for all possibilities.

But ultimately, provided the user can see the image in it's entirity without needing to flip their netbook on it's side, I imagine they'll be happy :)

Dave