relleno textview de Android entre líneas


En mi proyecto Android, tengo una vista de texto que muestra un texto largo. Quiero dar un poco de espacio entre líneas como lo hacemos en CSS con la propiedad line-height. ¿Cómo podemos hacer esto?

Author: Çağatay Gürtürk, 2011-07-28

5 answers

Puede usar lineSpacingExtra y lineSpacingMultiplier en su archivo XML.

 349
Author: Romain Guy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-12 17:49:21

Puede buscar en android:lineSpacingExtra y aplicarlo a su XML

Hay información adicional en esta página

O el método relacionado public void setLineSpacing (float add, float mult)

Más información aquí

 67
Author: sealz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-07-28 18:42:18

Si quieres relleno entre texto intenta LineSpacingExtra="10dp"

<TextView
        android:layout_width="match_parent"
        android:layout_height="180dp"
        android:lineSpacingExtra="10dp"/>
 60
Author: chanu panwar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-31 18:56:01

Puede usar la función TextView.setLineSpacing(n,m).

 16
Author: Vishnu Haridas,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-07-28 18:44:28

Añadiendo android:lineSpacingMultiplier="0.8" puede hacer que el interlineado sea del 80%.

 4
Author: Ajitsen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-04 06:42:32