mathew-kurian / TextJustify-Android

:page_facing_up: Android Text Full Jusiftication / Wrapping / Justify / Hyphenate - V2.0
https://github.com/bluejamesbond/TextJustify-Android/wiki
Apache License 2.0
1.86k stars 370 forks source link

OnPreDraw approach not working #10

Closed fscz closed 10 years ago

fscz commented 10 years ago

TextJustifyUtils.run((TextView)this);

Does not set correct block text on the text view.

1 I would expect this call to compute a String/CharSequence that has extra spaces set, such that a normal TextView shows block text. However it does not seem to do anything.

2 What does the origWidth parameter in "run(final TextView tv, float origWidth)" mean? Is that supposed to hold tv.getWidth() ?

mathew-kurian commented 10 years ago

@fscz That is the older method and I have not really looked at it for a while. I had places that there because I feared that Android 4.0+ (that's the only device I had) did not cache the entire TextView during paint. This method for faster render since I am not drawing out each letter as opposed to one large draw text command which will make rendering much faster. HOWEVER since android does cache, Option 2 is the older deprecated method - which I had to write for a Google interview.

UPDATED