Justify text in text mode does not work properly

I take the link from TextJustify-Android . I am using option 2 in the link above. When I launch my application in the emulator text, one word appears on one line, the next word on the next line, and so on. I do not know what is wrong in my code. Please help me. Thanks.

Action Class Code -

textView1 = (TextView) findViewById (R.id.textView1); textView1.setMovementMethod(new ScrollingMovementMethod()); textView1.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() { boolean isJustified = false; @Override public boolean onPreDraw() { if(!isJustified) { TextJustifyUtils.run(textView1,0); isJustified = true; } return true; } }); 

Xml code -

  <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="8" android:gravity="center"> <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="vertical" android:text="@string/his" android:textColor="#FFFFFF"/> </LinearLayout> 

And I implement the TextJustifyUtils in my application, as shown in the link above.

I made one change. This link says TextJustifyUtils.run(textView1); and in my eclipse code suggest me change in TextJustifyUtils.run(textView1,0); . Is there something wrong with this?

Update:

In TextJustifyUtils I change public static void justify(TextView textView) to public static void run(TextView textView) , as its author commented, and TextJustifyUtils.run(textView1,0); in TextJustifyUtils.run(textView1); in the class Activity. But the conclusion is the same as I type in text textView ie without justification.

+2
android github textview
source share
1 answer

If someone, following the link above to justify the text, select option 1. His work is beautiful. And if you have a problem. Ask the author. I think he is always happy to help you, good guy. How does he help me like that. And option 1 works with minor changes.

0
source share

All Articles