Search code examples
androidtextview

Evenly space out text inside a TextView


Is there a way to make a given text fill up the entire TextView width no matter on the length of the text by stretching the spaces between characters, similar to how word does so.


Solution

  • Your options are pretty limited with TextView.

    SUGGESTION: Try WebView (or equivalent), and you might be able to do something like this:

    Force single line of text in element to fill width with CSS

    div {
      text-align: justify;
    }
    
    div:after {
      content: "";
      display: inline-block;
      width: 100%;
    }