What is android:includeFontPadding for?

Vas picture Vas · Feb 28, 2016 · Viewed 8.4k times · Source

You can use android:includeFontPadding="false" to get rid of the default padding in a TextView. Android docs say this about the attribute:

Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly.

Questions:

  • What does the above mean? What is this padding used for?
  • Is it bad to turn it off and why?

Answer

Wackaloon picture Wackaloon · Apr 13, 2016

This is need for text size measure in height. If you turn it off, text will be forced to be some height, otherwise it will calculate height of each line with ascenders and descenders.

enter image description here