android-justifiedtextview icon indicating copy to clipboard operation
android-justifiedtextview copied to clipboard

last line problem

Open FrankLove opened this issue 10 years ago • 4 comments

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

FrankLove avatar Sep 07 '14 12:09 FrankLove

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; }

superxinzai avatar Oct 20 '14 07:10 superxinzai

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.

FrankLove avatar Oct 29 '14 15:10 FrankLove

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

greensky123 avatar May 05 '17 10:05 greensky123

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

ajitjati avatar Feb 05 '18 10:02 ajitjati