Home > database >  How to set sizes of each line on textView Android Studio?
How to set sizes of each line on textView Android Studio?

Time:09-05

I know that we can use android:maxLines="" for splitting a textview into multiple rows, but I want to give size for each row (not text size, but line size). My plan is to set the textsize 18sp and line height size 25dp for each row (I use match_parent for the width). Are there any possible way to do that?

CodePudding user response:

Two attributes (lineSpacingExtra & lineSpacingMultiplier) can be used in your xml file.

lineSpacingExtra : add extra spacing between lines of text of TextView

<TextView
    android:lineSpacingExtra="5dp" />

lineSpacingMultiplier : scale factor for height of line space

<TextView
    android:lineSpacingMultiplier=".6" />
//line spacing to 60%. 

CodePudding user response:

You means setText(SapnnableString)?

see: https://developer.android.com/develop/ui/views/text-and-emoji/spans

  • Related