text - Physical size of font in points in Android -


I have two devices - HTC tattoos and Sony Ericsson Xperia X10. One has 145 dpi, the other is 245 dpi.

When I specify the font size for a textView in digits, then in this way:

  textView.setTextSize (typed value. COMPLEX_UNIT_PT, 6.5 f) ;  

I get different physical size text on these two devices. At 245 dpi, the text is readily difficult.

Now, the size of "PT" is considered physically. I.e., in my test, both text blocks should contain letters of the same physical height. Which is not the case.

What can be wrong here?

Thanks for the help, Yuri.

pt is the unit number, which will not scale according to density. For non-text you want dive (or DP ), which are free pixels which are densely independent, it will be on the scale according to the density. For the text, you want , which will be on the scale according to the density but it will also be according to the user's preferred font size.

There is a bit of information about this, and here are more scattered Android docks

Update: Here is a description of each dimension units, But 72 inches of an inch does not seem to work like this, and the answer is simply to use DP and sp - if you want to If you want to show some points to the user, just do it

some math ( dp to 1px ma on 160dpi screen Security may, one inch) of 1/160 degree be.

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -