标签云

微信群

扫码加入我们

WeChat QR Code


Here is why we should use SP for fonts with example.

2018年10月23日15分55秒

This feels wrong, why are our layouts based on dp but all text rendered inside that layout scaled to user's sp settings? If the text becomes larger, shouldn't the containing view also grows to accommodate them?

2018年10月23日15分55秒

So, to simplify: sp = dp * scale

2018年10月23日15分55秒

chakrit You can use sp to build your layouts too.

2018年10月23日15分55秒

chakrit Not necessarily. If your views grow larger, the layout of your application will be different, which raises difficult questions. Should the views overlap? Should one displace another? Etc.

2018年10月23日15分55秒

chakrit Even if layouts are using dp, they should still be able to tolerate text becoming larger to some degree, otherwise this is poor design. Say, if a text label is constrained in width, it can still grow in height. If it's constrained in both, then you may have problems when the text becomes larger, for example, when translating into another language.

2018年10月23日15分55秒