Flexible android layout for multiple screen sizes/densities

久未见 提交于 2019-12-01 07:44:04

The android documentation has a great guide on the subject:

Supporting Multiple Screens

They introduce generalized sizes and densities and show how different resources can be loaded dynamically for different screens.

I'm new to android myself, so don't take my word for it, but, I think you can get away with one layout for all screen sizes, and I think RelativeLayout will work well (in most cases), especially with something as complex as a card game. I've mainly used LinearLayouts inside RelativeLayouts when I've wanted to align buttons/text horizontally.

oloan sembiring

firstly, I'm sorry my English is not good enough. You should divide your resources into some folders (based on screen size), for example, make different layouts from different resources. You can do like below:

1.drawable

-drawable-hdpi

-drawable-mdpi

-drawable-ldpi

2.layout

--layout-hdpi

--layout-mdpi

--layout-ldpi

customize your resource for each screen size, it makes your application is applicable for many device.

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