7

I created 4 different layout files and placed it in layout , layout-small,layout-large,layout-xlarge. folder and TESTED IN QVGA,HVGA,AND WXGA EMULATOR. But it is only taking the default layout(which i placed it in layout folder)for all emulator. Any solution?

Juan Cortés
  • 20,634
  • 8
  • 68
  • 91
vnshetty
  • 20,051
  • 23
  • 64
  • 102

2 Answers2

7

Have you given the same name to all layout file, for e.g. main.xml, i mean to say give the same name to xml layout files and places in the particular folder. It will automatically managed by Android itself, programmer need not to bother about the same.

I made my comment as answer as this is right as per vnshetty's comment above. So that other answers may not be selected as accepted wrongly.

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
  • but we are setting the content view as R.layout.name then how it will take automatically? Sorry that am a bit late :D @Paresh – AshMv Sep 25 '13 at 10:20
  • Thats the free gift from Android :) I mean Its system duty to choose layout based on the screen density. – Paresh Mayani Sep 25 '13 at 10:49
  • http://stackoverflow.com/questions/19002411/layout-small-is-not-working-android please see this @paresh – AshMv Sep 25 '13 at 10:53
  • As @PareshMayani says it works fine.But the problem i face is with some devices which have a smaller height and width(320x480) but higher dpi(306dpi) How to manage these other than programatically... What is the best practice here – Allen Jun 03 '14 at 09:48
2

http://developer.android.com/guide/topics/resources/providing-resources.html

layout-medium does not exist - should use layout-normal instead

Also are you specified min api version? it will works only if you specify <uses-sdk android:minSdkVersion="4" /> or higher in your manifest file.

CeKup
  • 989
  • 9
  • 6