Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between sw600dp and w600dp?

Tags:

android

layout

Please elaborate on the difference between sw<N>dp and w<N>dp, in a simple way. I have studied the complete documentation of screen sizes but am confused between these two qualifiers sw<> and w<>.

like image 836
Mudassar Shaheen Avatar asked Feb 14 '13 17:02

Mudassar Shaheen


People also ask

What is sw600dp?

SW : minimum distance between screen edges in dps your layout will run on, so if you use layout-sw600dp/ folder then all layouts inside it will only work on devices that has at least 600dp (width or height)

What is smallest width dp?

Smallest width qualifier Here's how other smallest width values correspond to typical screen sizes: 320dp: Typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc.) 480dp: Large phone screen ~5" (480x800 mdpi) 600dp: 7” tablet (600x1024 mdpi) 720dp: 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc.)


1 Answers

Android device screens are rectangles. Rectangles have two sides, one shorter than the other. Let's call the short one A and the long one B.

-swNNNdp indicates "use these resources if A is greater than or equal to NNN dp in length"

-wNNNdp indicates "use these resources if the width of the device, as presently held, is greater than or equal to NNN dp"

When the user rotates the device between portrait and landscape, the width will change (to be A or B), but A (the shortest width) is always the same.

like image 180
CommonsWare Avatar answered Oct 08 '22 22:10

CommonsWare