-4

I want to align text in My TextView like this

enter image description here

and my current appearance of textView is like

enter image description here

How can I achieve text layout without using Webview

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Shoaib Anwar
  • 819
  • 2
  • 12
  • 29

2 Answers2

3

TextView in Android O offers full justification (new typographic alignment) itself.

You just need to do this,

textView.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
default is JUSTIFICATION_MODE_NONE
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
Abdul Waheed
  • 4,540
  • 6
  • 35
  • 58
1

You can use:

https://github.com/bluejamesbond/TextJustify-Android

Install Just add to your build.gradle

dependencies {
    compile 'com.github.bluejamesbond:textjustify-android:2.1.6'
}

or

use : https://github.com/Saleh-Hassan/RTL-TextJustify-Android

Example:

enter image description here

enter image description here

Thientvse
  • 1,753
  • 1
  • 14
  • 23