Physical font size in pixels on Android

I have two devices - HTC Tattoo and Sony Ericsson Xperia X10. One has 145 DPI, the other 245 DPI.

When I specify the font size for the TextView in points, for example:

textView.setTextSize(TypedValue.COMPLEX_UNIT_PT, 6.5f);

I get a different physical text size on these two devices. At 245 DPI, the text is barely readable.

Now the size of "pt" should be physical. Ie, in my test both text blocks should have letters of the same physical height. This is not true.

What could be wrong here?

Thanks for the help, Yuri.

+3
source share
2 answers

In fact, dots always work when the underlying devices give the correct display performance.

, :

NAME      OS    metrics.ydpi  REAL_DPI  DDPI  SD
XPERIA    1.6   159.49677     325       240   1.5
Liquid    1.6   263.8958      285       240   1.5
Tattoo    1.6   145.14067     match     120   0.75
Hero      1.5   179.29352     match     -     1.0
Galaxy    1.6   160.41878     180       160   1.0

, HTC Tattoo HTC Hero Android API.

( ).

, , /, , 160 DPI DisplayMetrics # scaledDensity - , .

+5

pt - , . dip ( dp), . . sp, , .

, Android.

http://developer.android.com/guide/practices/screens_support.html#screen-independence

UPDATE: , , , , pt 1/72 . , , , dp sp - - , (dp) 1px 160dpi, .. 1/160th ).

http://developer.android.com/guide/topics/resources/more-resources.html#Dimension

+6

Source: https://habr.com/ru/post/1757810/


All Articles