0

I create an android application which could support multi-screens . And I use some layout folders to store layout files . This is my current layout folder structure .

enter image description here

But when I attempt to run this application on Samsung Galaxy S Duos 3 (http://www.gsmarena.com/samsung_galaxy_s_duos_3-6662.php) and Samsung Galaxy Grand Prime (http://www.gsmarena.com/samsung_galaxy_grand_prime-6708.php) it takes the layout from layout-sw320dp . I think it is wrong when it comes to landscape screens, because I can see some blank space to the right always. But I don't know what are the correct layout folders for the above devices, for the correct orientation.

Actually now I want to know what are the correct layout folders for the sizes of 5inch and 4inch devices (my devices also have the above sizes), and also possibly for 5.1 inch and above. And I am using Android Studio.

Have any ideas about this ?

Thank you .

Terance Wijesuriya
  • 1,928
  • 9
  • 31
  • 61

2 Answers2

1

why do you think it picked wrong layout (layout-sw320dp)? The dimension of the phone Samsung Galaxy S Duos 3 are 121.4 x 62.9 x 10.8 mm (4.78 x 2.48 x 0.43 in) - which means it picked the right (smallest width layout). Perhaps you mistaken the dimensions with resolution (480 x 800 pixels) - the layout rendering looks at the actual dimensions of the device's screen - not its resolution. This is true for the Samsung Galaxy Grand Prime as well - its dimensions are 144.8 x 72.1 x 8.6 mm (5.70 x 2.84 x 0.34 in) and should choose the smallest width layout of layout-sw320dp. So, in short, you have the right set-up in terms of layout folder-names, and your app picks them up correctly.

I hope this help you understand what is happening with your app.

ishmaelMakitla
  • 3,784
  • 3
  • 26
  • 32
1

this is still one of the bothering topics in Android but somehow i managed to deal with this but in a long way.

You have to tackle devices first by their screen sizes then in that screen range you have to check different density screens.

Example: layout-sw320dp (xhdpi devices) if you have only this layout folder then the devices below 5" will fall into this and upon not finding correct dpi layout folder they will render from here. So to overcome this and to get accurate layout for different device sizes and resolution i made these many layout folders and i have tested it on emulator and real devices as well.

enter image description here

enter image description here

I know this is very lengthy way but i tried many others way but every time i used to test on different devices it used to render abnormally while this one fixed issues to almost complete extent for me.

mfaisalhyder
  • 2,250
  • 3
  • 28
  • 38