How to design a layout for 1080*1920 pixel screens? Which layout folder works for Samsung galaxy S4?

丶灬走出姿态 提交于 2019-12-04 14:54:46

问题


I'm creating an application which works for all types of screens, but I'm having problems while creating layouts for the Samsung Galaxy S4 1080*1920 (5 inch screen).

Since 1080*1920 falls under 480dpi(XXHDPI), I have created folder called layout-sw480dp and have placed my file in there.

When I look at it from xml view it looks perfect, but when I run it and check, the alignment has been changed.

I have created other folders, such as layout-xxhdpi as well, and tried then but the alignment problem persists.

Are there any specific folders to place files for Samsung Galaxy S4?

I have attached links to show the problem I'm facing.

Thanks in advance

Here is the link for the screenshots

https://www.dropbox.com/s/65pqq65qm2va8jc/xml.gif

https://www.dropbox.com/s/3ewytmrt1jy7xc9/screenshot2.gif


回答1:


If you want to have a layout for your S4, you need to use the values-sw360dp folder.

The conversion is like this: px * 160 / dpi. In your case: 1080 * 160 / 480 = 360.

But anyway, your layout should work on all devices, not only the S4.



来源:https://stackoverflow.com/questions/17192703/how-to-design-a-layout-for-10801920-pixel-screens-which-layout-folder-works-fo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!