标签云

微信群

扫码加入我们

WeChat QR Code


stackoverflow.com/questions/2025282/…

2018年12月17日47分50秒

Ah, right. So I have to divide every dimension by that factor before setting in dimens.xml given I have the design in 1920x1080? Hmmm... so why is there need to have different dimens.xml files under values-swXXXXdp directories when dp is already doing this magic, I wonder?

2018年12月17日47分50秒

user4092233 Please refer to developer.android.com/training/multiscreen/index.html for details

2018年12月18日47分50秒

user4092233 - I rarely use different dimens.xml files for different configurations, although they have their uses. For instance, you might want different dimensions for different screen sizes. On a large screen, for example, you might want a 1/2 inch margin around a view. So regardless of the pixel density, you could specify a margin of 80dp (which would be 80 pixels on an mdpi device, but more like 223 pixels on a Nexus 5). On a smaller screen, you might want only a 1/8 inch margin, which would be 20dp. For density-independent dimensions, use /res/values-nodpi/dimens.xml and px, not dp.

2018年12月18日47分50秒