0

Recently I have to develop a simple app for my company with UI which has to look alike in different set of screens. I was provided only one set of drawable-resources.

I have gone through the android developer.

In the link, they showed an example which divided the drawable folder into based on density and layoput folder based in sizes.

Since I had only one set of images, Can I divide the screen based on density like

  1. layout-ldpi
  2. layout-mdpi
  3. layout-hdpi
  4. layout-xhdpi

Can I do it in this manner? And how far is it reliable?

Baradwaj Aryasomayajula
  • 1,184
  • 1
  • 16
  • 42

1 Answers1

2

u should create drawable folders for all layout designs. it automatically takes the respective drawable folder for respectve density.

res/drawable-ldpi
res/drawable-mdpi
res/drawable-hdpi
res/drawable-xhdpi

so on..

mdpi is the base, means u first add images in ur mdpi folder and then convert images for others drawables

check this too: same for drawable and values

res/layout-sw320dp-ldpi
res/layout-sw320dp-mdpi
res/layout-sw320dp-hdpi
res/layout-sw320dp-xhdpi and so on..

res/layout-sw480dp-ldpi
res/layout-sw480dp-mdpi
res/layout-sw480dp-hdpi
res/layout-sw480dp-xhdpi and so on..

res/layout-sw600dp-ldpi
res/layout-sw600dp-mdpi
res/layout-sw600dp-hdpi
res/layout-sw600dp-xhdpi and so on..

res/layout-sw720dp-ldpi
res/layout-sw720dp-mdpi
res/layout-sw720dp-hdpi
res/layout-sw720dp-xhdpi and so on..

more info:

Different resolution support android

Application Skeleton to support multiple screen

Is there a list of screen resolutions for all Android based phones and tablets?

Community
  • 1
  • 1
M S Gadag
  • 2,057
  • 1
  • 12
  • 15
  • Hi Gadag, So what you say is that it is sufficient if I create one layout folder but different drawable folders as mentioned in the [link](http://stackoverflow.com/a/12258061/1662775) – Baradwaj Aryasomayajula Dec 04 '14 at 08:54
  • ya and u should create values file too for layouts to add styles and dimens. – M S Gadag Dec 04 '14 at 08:57
  • Ok and this would be last question... On what basis should I create my layout folders.. Based on sizes or based on densities... – Baradwaj Aryasomayajula Dec 04 '14 at 10:45
  • So I have to create folders just like drawable folders right... Like layout-ldpi, layout-mdpi, layout-hdpi and so on.. Thank you.. – Baradwaj Aryasomayajula Dec 04 '14 at 11:02
  • its work with a single xml layout also.. although its good to add layout folders .. but drawables and values are must cos the device will access respective folder or defaultly its next greater .. this is confuses a lot so before implementing pls be clear. ex. nexus seven(7.3 inch, 800*1280) will access layout-large-tvdpi, wrt drawable-large-tvdpi, values-large-tvdpi. – M S Gadag Dec 04 '14 at 11:08