kanga
kanga

Reputation: 35

How to have android application support multiple screen sizes with <supports-screens

So I used the following code below to have my application to scale screen size on different android devices but when I am testing on my Nexus 7 its does not scale and its as if it was on a 4 inch screen. When I run it in the emulator on a 7 inch screen it works. Anything wrong with my manifest file?

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

this code goes right before the "application" part right?

Upvotes: 1

Views: 5485

Answers (2)

Passion
Passion

Reputation: 662

Use Relative layout it will solve most of your problem .Additional use Folder name with given below the way i am dealing with multiple screen is this way and its working fine.....if any one has improved wayso do guide me

Screen size 480x800

layout-normal-hdpi-480x800

drawable-normal-hdpi-480x800

Screen size Galaxy Nexus--- though its size is 1280x720 but in actual due to system bar its dimension(screen size) differs

layout-normal-xhdpi

drawable-normal-xhdpi

Screen size Note 5.3---

layout-normal-xhdpi-1280x800

drawable-normal-xhdpi-1280x800

Screen size S3---

layout-normal-xhdpi-1280x720

drawable-normal-xhdpi-1280x720

Screen size 7inch tab 2 supporting OS version 3 and above--- dont write dimension 1026x600 bsz in actual due to system bar its dimension(screen size) differs

layout-large-mdpi

drawable-large-mdpi

Screen size 7inch tab p1000 etc supoorting os verion less than 3---

layout-large-hdpi-1024x600

drawable-large-hdpi-1024x600

Screen size 1280x800 tab 10.1,10.2,note 10.1 etc--- you can add dimension if you want other wise it is fine

layout-xlarge-mdpi

drawable-xlarge-mdpi

Upvotes: 0

Piotr Chojnacki
Piotr Chojnacki

Reputation: 6857

Ok, so what you have to know is that support-screens doesn't make your application look 'nice' on screens you are supporting (check this link). It just tells that users with such screens will be able to download your application, but it's up to you to make it display properly. You have to create layouts for specific screens on your own.

More about it you can read in Android's documentation: http://developer.android.com/guide/practices/screens_support.html

Basically, you have to properly name your directories in which layout files are stored in order to let Android know which one should it pick up for specific device. If for example your layout's file was "layout.xml" you should have:

/res/layout/layout.xml         // Default layout
/res/layout-small/layout.xml   // Small screens
/res/layout-large/layout.xml   // Large screens
/res/layout-xlarge/layout.xml  // Extra large screens

You can go even further and make also different layouts for portrait and landscape views by specyfing another keyword in directory's name:

/res/layout-small-land/layout.xml      // Small screens, landscape view
/res/layout-small-portrait/layout.xml  // Small screens, portrait view

Remember that tags order is important, so you can't write layout-portrait-small.

Upvotes: 4

Related Questions