Question

I have different layout files for different screens size like

Folder Structure:

  • layout
  • layout-large
  • layout-small

    For emulators like HVGA and QVGA there is no problem, the respective layout.xml file being refereed. But the layout-large folder is ignored when I run the emulator of WVGA(480x854) , here it is referring the "layout" folder of the application. Please point me to the right direction which is right way to handle this situation.

    I tried using

layout-large-hdpi layout-large-mdpi layout-large-ldpi layout-normal-hdpi layout-normal-mdpi layout-normal-ldpi

And in the AndroidManifest.xml I specified

   <supports-screens
   android:largeScreens="true"
   android:normalScreens="true"
   android:smallScreens="true"
   android:anyDensity="true" />

but no success

Was it helpful?

Solution

Have you checked if your API Level is already supporting this? I had this issue as well. In my case I used following line in the manifest, which set the TargetSDK to 4 (1.6), where the support of those different layouts started.

<uses-sdk android:minSdkVersion="3"  android:targetSdkVersion="4" />

Links:
Screen Support

OTHER TIPS

I think the Problem is that people always create a large screen by AVD Manager and it sets the default density to 240 which is not supported by /res/layout-large If you want to want to test /res/layout-large/any_layout.xml then you should see the density of your virtual device it should be set to 160 not 240 or 120

Make sure the set up emulator's default size is "large" and not "xlarge".

For example if the emulator size is "xlarge", then the "layout-large" folder will be ignored and the default "layout" folder will be used, because it can't find a "layout-xlarge" folder.

This is easy to identify if your using Android Studio.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top