0

I am working on android app, i want that this app must fit on different screen sizes and densities. I have made files.xml files in res/layout by default, res/layout-small/xml files for supporting small screens such as QVGA (low density) ,res/layout-normal/xml files for supporting medium screens such as HVGA(medium density) and res/layout-large/xml files for large screens such as WVGA800(high density). When i run app initially on medium size screen such as 320x480 i-e HVGA it runs perfectly but when i run same app on large or small screen emulator it displays same layouts which were displayed on medium size screen and doesn't fit on the screen and vice versa. I havn't use absolute layout and used dp instead of px or sp or dip. I have tried alot but couldn't succeded. How should i handle that situation? Any idea?

Larik
  • 99
  • 3
  • 10
  • Have a look at : http://developer.android.com/guide/practices/screens_support.html – NickLH Oct 27 '11 at 00:17
  • Yes i have followed that guide and write all screens and any density equals to true in manifest also, but i do not where i am missing? – Larik Oct 27 '11 at 00:27
  • It's hard to say since you don't show any of what you have done... – NickLH Oct 27 '11 at 00:41
  • NickLH i have created different layout representations for small, normal and high screen resolutions. I think android simply finds screen configurations and matches the best resources according to configuration. I have created three emulators of different skins QVGA, HVGA and WVGA to test the app on all densities. – Larik Oct 27 '11 at 01:22

1 Answers1

0

A few things to try,

  1. Dump the actual screen size at run time to confirm the screen size is what you are expecting see Get screen dimensions in pixels

  2. Temporarily remove the contents of the res/layout folder to debug where the resources are being pulled from.

Generally you should be able to support QVGA and HVGA with the same layout resource but adaptable widths and heights, eg fill_parent etc. Then have a seperate layout for tablets.

Community
  • 1
  • 1
railwayparade
  • 5,154
  • 1
  • 39
  • 49
  • Thanks for response parade. I have tried 2 trick but it pulls resources from layout-normal file. I have made layouts for QVGA , HVGA and WVGA separately , i think it is android responsibility to pull resources according to screen configuration. – Larik Oct 27 '11 at 01:14