ufo22940268 / android-justifiedtextview

android justified textview
950 stars 243 forks source link

last line problem #1

Open FrankLove opened 10 years ago

FrankLove commented 10 years ago

one: when i use it to show chinese text,if last line only have several chinese it will insert some space untill the line is full,i set my font and textsize is 30 two: if the text is english and chinese together in one line (i test is the third line)also will have the first problem can you have a test ,thanks

superxinzai commented 10 years ago

in function onDraw() of JustifyTextView, you could try this: @Override protected void onDraw(Canvas canvas) { ... for (int i = 0; i < layout.getLineCount(); i++) { ... if(i<layout.getLineCount()-1) if (needScale(line)) { drawScaledText(canvas, lineStart, line, width); } else { canvas.drawText(line, 0, mLineY, paint); } else canvas.drawText(line, 0, mLineY, paint); mLineY += textHeight; }

FrankLove commented 10 years ago

thanks for your repay!

Sent from Windows Mail

From: superxinzai Sent: ‎Monday‎, ‎October‎ ‎20‎, ‎2014 ‎3‎:‎38‎ ‎PM To: ufo22940268/android-justifiedtextview Cc: zhiwen zheng

in function onDraw() of JustifyTextView, you could try this: @Override protected void onDraw(Canvas canvas) { ... for (int i = 0; i < layout.getLineCount(); i++) { ... if(i<layout.getLineCount()-1) if (needScale(line)) { drawScaledText(canvas, lineStart, line, width); } else { canvas.drawText(line, 0, mLineY, paint); } else canvas.drawText(line, 0, mLineY, paint); mLineY += textHeight; }

— Reply to this email directly or view it on GitHub.

greensky123 commented 7 years ago

when i set text tv.setText(Html.fromHtml(""+str+""),the Underline is dismiss.please author solve the problem

ajitjati commented 6 years ago

Add "\n" to end of the string it will not stretch the line.