Home > Software engineering >  Justify align text in static layout?
Justify align text in static layout?

Time:10-27

How do I JUSTIFY align text in a static layout programmatically? Thanks for your time.

I only see the following options for staticLayout.setAlignment():

Layout.Alignment.ALIGN_CENTER
Layout.Alignment.ALIGN_NORMAL
Layout.Alignment.ALIGN_OPPOSITE

enter image description here

CodePudding user response:

You can set it like textView.justificationMode = JUSTIFICATION_MODE_INTER_WORD. But it requires Android O (Api level 26).

source: https://stackoverflow.com/a/42991773/19115089

Another option would be to try a third party library like https://github.com/mathew-kurian/TextJustify-Android (but no longer maintained)

  • Related