Coeee
Coeee

Reputation: 28

Is creating Android layout files for different DPIs necessary?

I recently downloaded some famous apks(like Instagram) and unzip them, I found out that they only contain single "layout" folder, however, Google advised using layout-hdpi,layout-xxhdpi to support different screens.

When I develop my own app I find if I use "xhpi ratio"(1dp = 3px), the app works fine for almost all devices(from 320*480 to 1080*1920).

And I'm using Android Studio under Windows now, the default structure only contains "layout" folder alone.

So, is it necessary to create different layout files to support different dpis? And what is right way to adapt the various android screens?

Upvotes: 1

Views: 119

Answers (3)

Bojan Kseneman
Bojan Kseneman

Reputation: 15668

Changing several layouts when you are changing/updating your UI is a pain in the a.. Make your best to keep as min. number of layouts you need to maintain for your own good. Make one for phone, one for the tablet if you really must.

Upvotes: 1

kiturk3
kiturk3

Reputation: 558

It depends. I had done some apps with only one layout folder and also some which has even 5 folders to perform well on different devices. I have mindset that if i use Relativeayout, i won't have to use multiple screen. Its just according to me. If you have observed instagram doesn't contain much complex design so may be they did not need to. as well as they only had to put things inside container(relative or linear) and the container are in order .

Upvotes: 0

smb
smb

Reputation: 834

Google advised using layout-hdpi,layout-xxhdpi to support different screens

Where is it written? Usually drawables are put into directories with different density, but not layouts. Sometimes different layouts are created for different screen sizes (not density) and orientation (portrait, landscape).

Upvotes: 1

Related Questions