0

I am displaying a large block of text in a TextView within a ScrollView like such.

<ScrollView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/date_text"
    android:id="@+id/scrollView">
    <TextView
        android:id="@+id/explenation_text"
        android:text="@string/explanation_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</ScrollView>

Would there be a way to have my text aligned to the right, therefore to have one block of text without varying line sizes?

1 Answers1

0

I think what you are asking is Justify Block of Text inside a Textview...

Here what i found when i face this problem:

  1. Android do not supports full justification. see this Android TextView Justify Text

  2. you can use Gravity but it will not solve your problem in every case gravity attribute specifies how to align the text inside the TextView layout_gravity specifies how to align/layout the TextView element itself.

  3. You can use webview to align a block of text in your layout http://www.seal.io/2010/12/only-way-how-to-align-text-in-block-in.html

  4. There are some open source library which you can use to justify your Textview text

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

https://github.com/navabi/JustifiedTextView

Community
  • 1
  • 1
rafsanahmad007
  • 23,683
  • 6
  • 47
  • 62