An sp is the same base unit (as dp), but is scaled by the user's preferred text size (it's a scale-independent pixel), so you should use this measurement unit when defining text size (but never for layout sizes).
SP: is an abbreviation for Scale independent pixels. It is the same as the dp unit, but it is additionally scaled according to the user's font size selection.
Font size can direct the attention of the user Using larger fonts as headings and titles can really grab the attention of the user, and help them to slow down while scrolling through your website. The best practice is to use this above the fold, to really draw users into your website.
Best unit for text is sp and for dimensions best unit is dp.
The dp
has constant ratio transition to px
: dp = px * ratio
. Where ratio
will never change on any particular device.
While sp
(s for scaled) has scalable ratio: sp = px * ratio * scale
. Where ratio
never changes, but scale
is user configurable. This scale
can be used by people who need larger font sizes, for example, to use device more comfortably.
Sp is scaled independently with respect to the normal font size of the device. http://developer.android.com/guide/practices/screens_support.html
Similarly, you should prefer the sp (scale-independent pixel) to define text sizes. The sp scale factor depends on a user setting and the system scales the size the same as it does for dp.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With