0

I want to design a application for different tablets so i created different layout folders i.e.

  • layout-sw600dp
  • layout-sw720dp

Now the problem is that i am testing the application in 2 tabs having 1280x800 & 2048x1536 resolutions respectively and they both fall under layout-sw720dp folder only. So how can i differentiate between both of them so that i can draw layouts separately.

Or i just need to get the pixel density and calculate for each and everything to design for these tabs like this :

dp = px / (dpi / 160) 
Anmol317
  • 1,356
  • 1
  • 14
  • 31
  • 1
    Possible duplicate of [What is the difference between "px", "dip", "dp" and "sp"?](https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp) – Petter Friberg Apr 16 '18 at 11:21

1 Answers1

1

Please refer to this DOCUMENTATION and also this link

+----------------+----------------+---------------+-------------------------------+
| Density Bucket | Screen Density | Physical Size | Pixel Size                    | 
+----------------+----------------+---------------+-------------------------------+
| ldpi           | 120 dpi        | 0.5 x 0.5 in  | 0.5 in * 120 dpi = 60x60 px   | 
+----------------+----------------+---------------+-------------------------------+
| mdpi           | 160 dpi        | 0.5 x 0.5 in  | 0.5 in * 160 dpi = 80x80 px   | 
+----------------+----------------+---------------+-------------------------------+
| hdpi           | 240 dpi        | 0.5 x 0.5 in  | 0.5 in * 240 dpi = 120x120 px | 
+----------------+----------------+---------------+-------------------------------+
| xhdpi          | 320 dpi        | 0.5 x 0.5 in  | 0.5 in * 320 dpi = 160x160 px | 
+----------------+----------------+---------------+-------------------------------+
| xxhdpi         | 480 dpi        | 0.5 x 0.5 in  | 0.5 in * 480 dpi = 240x240 px | 
+----------------+----------------+---------------+-------------------------------+
| xxxhdpi        | 640 dpi        | 0.5 x 0.5 in  | 0.5 in * 640 dpi = 320x320 px | 
+----------------+----------------+---------------+-------------------------------+

If layouts are problem then why don't you try using SPD library for margin padding dimens.

Using this you may have to make only one layout for all screen sizes

Deep Patel
  • 2,584
  • 2
  • 15
  • 28
  • i know i can do it by calculating the pixel density thats what i am asking that the only way i can do it is by calculating that for each view only or i can somehow make a different layout separately for both. – Anmol317 Apr 16 '18 at 11:17
  • If layouts are problem then why don't you try using https://github.com/intuit/sdp for margin padding dimens. Using this you may have to make only one layout for all screen sizes – Deep Patel Apr 16 '18 at 11:19