简体   繁体   中英

Supporting different devices with different layout

I have doubt in making the layout for other deices I mean to support different devices of different resolutions. I have made an application and it is working well on hdpi devices and I tested on Samsung Galaxy grand which has 320dp-460dp and 480px-800px.

May application is looking awesome on this device. but when I run on other devices its gone bad. SO I am suggested to make the folder like layout-large, layout-xlarge and layout-xxlarge but there is a lot of difference in this link and this link

So this makes me confuse , with which name I have to make the layout folders to support all devices ?? please tell me

and also tell me I have some hard coded values in my layout such as left margin 13 dp to make my design look perfect on hdpi device should I make it more in other xhdpi devices ???

and also which devices comes in layout-large folder and so on please answer my both confusion , thanks in advance

I use Google's code as an example of how to do stuff. The docs on "Supporting multiple screen" is a bit old and outdated. The best way to keep up with the current conventions is to follow other's codes.

Here is the source code for the Calendar app. Yes, there a lot of different folders for layouts/drawable/values but you have to consider the fact that there are a lot of devices with varying sizes and pixel densities.

Also, why do you want to make many folders for layout? You make a few layouts and let the values and drawables do the rest of the work. Hope it's helpful.

IF you are interested in knowing which device falls under which folder, then check this figure from the Official Android Guide :

Android如何大致将实际尺寸和密度映射到广义尺寸和密度的图示(数字不准确)。

Of course you need to know the actual size or density of the physical device

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM