-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,352
  • 21
  • 80
  • 110
Shoaib Anwar
  • 766
  • 2
  • 8
  • 25

2 Answers2

2

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
  • 63,753
  • 16
  • 113
  • 150
Abdul Waheed
  • 4,304
  • 5
  • 32
  • 53
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,719
  • 1
  • 14
  • 23