How to Add Many Spaces After the Text in Textview

How to add many spaces after the text in TextView

By transforming Text as Html,you can solve that problem
this is one way to solve that :
message.setText(Html.fromHtml((myString + "      "));

How do I give space in between text in textview?

We can use it.

<TextView android:layout_width="fill_parent"
android:text="A B     C"/>

How to increase the spacing between paragraphs in a textview

You can use Spannable's to achieve this:

String formattedText = text.replaceAll("\n", "\n\n");
SpannableString spannableString = new SpannableString(formattedText);

Matcher matcher = Pattern.compile("\n\n").matcher(formattedText);
while (matcher.find()) {
spannableString.setSpan(new AbsoluteSizeSpan(25, true), matcher.start() + 1, matcher.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

The code above replaces all line breaks with two line breaks. After that it sets absolute size for each second line break.

Android TextView padding between lines

You can use lineSpacingExtra and lineSpacingMultiplier in your XML file.

additonal line space in textview

Definitely, Its device specific issue.

For better output in all devices you should use ScrollView as a container of your TextView.

In addition, If you want to add some extra space between text lines then you can use textView.setLineSpacing() programmatically or from XML you can use attribute android:lineSpacingMultiplier="1.3" to TextView for extra spacing.

Hope this will help~

How to change letter spacing in a Textview?

check out android:textScaleX

Depending on how much spacing you need, this might help. That's the only thing remotely related to letter-spacing in the TextView.

Edit: please see @JerabekJakub's response below for an updated, better method to do this starting with api 21 (Lollipop)

Related Topics

Leave a reply