Difference between sw600dp and w600dp?

Please describe in detail the difference between sw<N>dp and s<N>dp . I studied the full documentation of screen sizes, but I'm confused between the two qualifiers sw <> and w <> .

+46
android layout
Feb 14 '13 at 17:37
source share
2 answers

Android device screens are rectangles. Rectangles have two sides, one shorter than the other. Let me call short A and long 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 currently being held, is greater than or equal to NNN dp "

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

+109
Feb 14 '13 at 17:42
source share

Please see Screen Support

According to the docs:

SW : fundamental screen size, as evidenced by the shortest available screen area. In particular, the smallestWidth device is the shortest available in height and width of the screen (you can also consider it the "minimum width" for the screen). You can use this qualifier to ensure that, regardless of the current screen orientation, your application has at least the dps of the width available to it.

and W : sets the minimum available width in units of dp in which resources should be used - determined by the value. The corresponding system value for width changes when the screen orientation switches between landscape and portrait to reflect the current actual width available for your user interface.

To my mind:

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

W : means your layout will work on any device with a width of n dp regardless of height or, possibly, the device is currently in landscape mode (in this case, w will refer to height .. since the orientation is different between landscape and portrait)

+13
Feb 14 '13 at 17:43
source share



All Articles