screen support multiple devices using layout-large,layout-normal and layout-xlarge folders
Asked Answered
H

2

6

I created layout-large, layout-normal and layout-xlarge in the res folder and I copied all the xml files to those layout folders

First, I want to ask what is the difference between layout (the default) and layout-normal folder?

I know if I run the application on big screen size the app will take the xml files from layout-xlarge. So I made all the elements in layout-xlarge look as I want using FrameLayout in tap2 10.1, but when I run it in note2 or s3 mobile it looks different because the screen size is not same.

So how can I make the the application run in tap2 10.1 (1,280 x 800) and note2 or s3 mobile (1,280 x 720) size?

Harbourage answered 28/7, 2013 at 19:51 Comment(0)
Z
12

Here there is the official description of how support all the screen size. And as described the layout folders are:

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

So layout and layout-normal folder are the same, but in the new Android API there isn't no more the layout-normal folder, but only layout folder. Also you have to know if there isn't the specific layout of the screen size in witch the app is running, by default the app takes the "default" layout.

EDIT

You can have different screen resolutions in the same folder, as you can learn from this images:

enter image description here

If you want a more specific layout for specific resolution you have to detect at run time the exact screen size.

Zaneta answered 28/7, 2013 at 20:2 Comment(3)
but there is more than one size in each folderHarbourage
for example 1,280 x 800 and 1,280 x 720 they are both in layout-xlargeHarbourage
Just to confirm, when you create both a layout and layout-large xml file, the device will select the appropriate layout depending on the hardware? I.e. you don't have to add in any code to check the screen size and then tell it which layout to use?Boathouse
P
0

From Supporting Multiple Screens, you should define layout folder like this

res/layout/my_layout.xml              // layout for normal screen size ("default")
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

(the screen type base on)

xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp
Perretta answered 21/10, 2016 at 7:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.