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<>.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Please take a look at Screen Support
According to the documentations :
SW : The fundamental size of a screen, as indicated by the shortest dimension of the available screen area. Specifically, the device's smallestWidth is the shortest of the screen's available height and width (you may also think of it as the "smallest possible width" for the screen). You can use this qualifier to ensure that, regardless of the screen's current orientation, your application's has at least dps of width available for it UI.
while W : Specifies a minimum available width in dp units at which the resources should be used—defined by the value. The system's corresponding value for the width changes when the screen's orientation switches between landscape and portrait to reflect the current actual width that's available for your UI.
In my words :
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)
W : means your layout will work on any device with n dp width regardless of the height or maybe the device currently in landscape mode (in this case w would refer to the height .. since orientation differs between landscape and portrait)
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 NNNdp
in length"-wNNNdp
indicates "use these resources if the width of the device, as presently held, is greater than or equal to NNNdp
"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.