Search code examples
androiddpi

Device independent pixels vs Scale independent pixels


I know this question has been discussed over and over, but I still get confused with an answer to a very popular question in stackoverlow.

enter image description here

More specifically this example.

Simple question. Shouldn't the text in DP and SP look the same on all screens ? They both have ~160 physical units per inch. My only assumption is the text referenced to 30sp is dependent of another factor.


Solution

  • Not necessarily, DP is independent of a user's font settings whereas SP retains it. If a user has their settings so that the font on their device is enlarged (for accessibility reasons for example), SP will take that into account, whereas DP will not.