How To Create Screen Size Independent Android Applications

By | January 20, 2014

Recommended Products


I have been working with Android since the first beta release of the SDK. At that time there was no more than one Android device on the market, the HTC Dream, with a screen size of 3.2 inches and a resolution of 320×480. Since then Android devices have started to grow. Both devices with small screens like the HTC Tattoo, with a screen size of 2.8 inches and a resolution of 240×320, and almost-laptop devices like the Acer One. It was easy for us, developers to create applications that looked fine in an Android device. Now, we have to be careful, our good looking application can be transformed into a badly formatted application with missing icons and odd views.

So, from now on, if we are developing using the Android SDK 1.6 +, we have to take care about the size of the screen, if we want to run our application in multiple devices!

First of all let’s see some concepts we need to know before taking care of our images, views and pixels.

Some concepts

*Resolution. Well, this is not a very difficult concept, we are all very familiar with this word. So, the resolution of the screen, is the size (width x height) in pixels. As I said before, and the HTC Dream device has a 320 x 480 resolution screen.

*Screen size. This is normally measured in inches. Its the diagonal size of the screen. 4 inches is the screen size of the Sony Ericsson X10 (Rachel).

*Density. In the base of the Resolution, we have the Density of pixels in the screen.

Now, with these concepts in mind, lets see what Android can offer us to work with in terms of screen sizes.

In Android, we work with the screen size and its density. To simplify we can check all the screen configurations available in Android by looking at the following table:

Recommended Products....