0

I would like to add a margin/padding between two words in a string.

I'm currently using SpannableString in order to customize the string. For font color and size etc. Now I need to add a fixed margin between the words. I tried adding \n\n in strings.xml but it is not accurate. What I did currently,

<string name="registration_success">You have been successfully registered 
                  and your number is: \n\n%1$s</string>

Any other ways?

Vrushi Patel
  • 2,361
  • 1
  • 17
  • 30
Clint Paul
  • 313
  • 2
  • 6
  • 18
  • https://stackoverflow.com/questions/1587056/how-to-keep-the-spaces-at-the-end-and-or-at-the-beginning-of-a-string – Adil Mar 05 '19 at 06:49

1 Answers1

0

To use fixed margin or whitespace between two words of a string you can use: &#160 for non-breakable whitespace and &#032 for regular space. As XML doesnt take whitespace as it is. It will trim that space. By using &#160 or &#032 you can achieve regular padding or margin between words