Retrieve Line Spacing In Textview - Android
How can I retrieve the line spacing values (as currently applied to a piece of text) in a TextView? In API 16 and above, the appropriate functions to call would be getLineSpacingEx
Solution 1:
Looking at the source of TextView
as given here shows that getLineHeight
returns an integer
for the line height whose 'formula' is given as:
lineHeight = FastMath.round(mTextPaint.getFontMetricsInt(null) * mSpacingMult
+ mSpacingAdd);
mSpacingMult
and mSpacingAdd
can be set with setLineSpacing(float mult, float add)
. Both these functions are available since API Level 1.
Post a Comment for "Retrieve Line Spacing In Textview - Android"