tags:

views:

58

answers:

2

Hi,

Can you please tell me how can I specify dimension of layout for different density of screen? i.e. the layout are the same across different densities, but some dimension are different. how can I do that?

Thank you.

A: 

You can use different units to have the dimensions adapt to the screen.

Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

Available Resource Types

Supporting Multiple Screens

drawnonward
A: 

you define you layout and put it under

res/layout-Qualifier/my_layout.xml
where Qualifier could be one or more of the following

size : small, normal, large

density: ldpi,mdpi, hdpi.

For example layout for large screen with high density would be res/layout-hdpi-large/my_layout.xml

For full list of attributes see answer above

Alex Volovoy
But that mean I need to copy and past my 'my_layout.xml' file to different directories with only the width/height values different? Can I put 3 different dimens.xml files and have my_layout.xml to look it up?
michael