Archie.bpgc
Archie.bpgc

Reputation: 24012

Application to support multiple screen resolutions

enter image description here

I have 3 layout folders in my project:

1. layout

2. layout-large

3. layout-small

and as of now i don't have anything in layout-small but layout has layouts with small dimensions and layout-large has layouts with large dimensions.

The problem is:

when i test my app on a 240x320 it uses layouts from layout

when i test my app on a 480x800 even now it uses layouts from layout

Is it because thought i have layout-large, 480x800 doesn't fall into large screens, hence uses the default layout folder?

If that is the case, how can i make layouts for Normal Screens there is nothing like layout-normal or layout-medium.

Moreover, if i design my layout for HVGA (320x480) it should work perfectly for WVGA800 (480x800) since they both fall under same screen size, only density changes. And i am using dp everywhere. Am i right?

any help appreciated.

Upvotes: 1

Views: 425

Answers (4)

When it comes to xlarge, large and small then it is depending on size(inches) not on dpi of your device see below for specification

enter image description here

Additionally DPI is basically for Drawables while SIZE is for Layout.

Upvotes: 1

Aarun
Aarun

Reputation: 564

I think I got what is going wrong with you........ lets try this. suppose you are going to make the application compatible for 480x800 resolution.So for that first of all create two folder for it i.e.

1.layout-sw480dp this is for landscape.

2.layout-sw480dp-port for portrait mode.

Now,put all layout of the resolution of 480X800 in it.you see it will run easily on the particular resolution.

Note:- point here to be noted that for any device resolution let A X B. the name of the layout folder is goes like this.

1.layout-swAdp.

2.layout-swAdp-port.

here "A" is the screen resolution height value of device.

i hope it work for you.

Upvotes: 0

akemalFirdaus
akemalFirdaus

Reputation: 606

You should check this developer page out it helped me alot. http://developer.android.com/guide/practices/screens_support.html

Even if they have different resolution or screen size that doesnt mean that they have different pixel density. For example a large screen may have less pixel density than a smaller screen.

Another example would be the Samsung Galaxy tab which is 10.1 inch but is still mdpi-large and Nexus One which is less than 5 inch but uses hdpi.

Best of luck

Upvotes: 0

Varun Vishnoi
Varun Vishnoi

Reputation: 990

Just use the following details it may work but i am not sure..

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

res/drawable-mdpi/my_icon.png        // bitmap for medium density
res/drawable-hdpi/my_icon.png        // bitmap for high density
res/drawable-xhdpi/my_icon.png       // bitmap for extra high density

Just try....

Upvotes: 0

Related Questions