So I have android 2.3.5 device which is NORMAL/HDPI. I have a dimens.xml in my project:
...
20sp
Per the Supporting Different Screen Densities training, hdpi is 1.5x normal (mdpi) sizes. As getDimensionPixelSize
takes this difference into account when converting into pixels, the returned value will be 1.5x your value in sp
.
Note that sp
is also dependent on the user's preferred text size and can therefore change to be even larger than 1.5x your expected value.