How do you make layouts for several Android screen sizes? How do you make layouts for several Android screen sizes? android android

How do you make layouts for several Android screen sizes?


There are two axes to consider when it comes to screen size: physical size and density. Density is handled by providing measurements in dips and scaled resources as appropriate. But density does not always imply size or vice versa. See http://developer.android.com/guide/practices/screens_support.html for some further info on the mechanics.

It is not common or recommended to have different layouts based on each screen resolution you support, but it is entirely reasonable to design different layouts for different size classes (small, medium, large). Different sized screens might benefit from adding, removing, or repositioning certain navigation elements depending on the app.

Within a certain size class you should make sure that your layouts tolerate variances in exact screen resolution. As Falmarri suggested, use relative layouts, weights, and the other tools available to let your layout stretch gracefully.


The general rule is to use Density Independent Pixels (dips) for size definitions in your layout xmls - I see you already do it. Doing so I just have the only layout for all range of devices. What needs to be splited is graphics. For that I use 3 different drawable directories - 'drawable-ldpi', 'drawable-mdpi' and 'drawable-hdpi'. This is done in order images to have the same size (let say, in millimeters) on various screen densities (assuming screen size is the same - Normal, for instance) they should be scaled as follows:

  • drawable-hdpi: 150%
  • drawable-mdpi: 100%
  • drawable-ldpi: 75%

Probably it is a bad advice. However, if you look at the Google chart of Screen Sizes and Densities you can decide to not invest your additional efforts to thorough testing for Large screens, since there are almost no such devices on the market.


No making separate layouts is not really common practice. Only when you have images that can't be stretched is that really the recommended way.

Stuff will always look a little stretched/compressed when viewing it on devices with smaller/larger screens. That's kind of the definition of a different size screen. You should just use relative layouts and let android control the specific pixel numbers.