1

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 getLineSpacingExtra() and getLineSpacingMultiplier(). What are the appropriate functions for API version less than 16?

Sriram
  • 10,298
  • 21
  • 83
  • 136

1 Answers1

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.

Sriram
  • 10,298
  • 21
  • 83
  • 136