我所需要的电流 TEXTSIZE
的的TextView
在 SP 单位。
I need the current TextSize
of the TextView
in sp
units.
但 getTextSize()
返回像素大小
。那么,有没有办法将转换为像素SP
?
But getTextSize()
returns the size in pixels
. So is there a way to convert pixels to sp
?
请参见 DisplayMetrics 类,它有一个 densityDpi()和 scaledDensity()
。
See the DisplayMetrics class, it has methods for densityDpi()
and scaledDensity()
.