Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

last line problem #1

Open
FrankLove opened this issue Sep 7, 2014 · 4 comments
Open

last line problem #1

FrankLove opened this issue Sep 7, 2014 · 4 comments

Comments

@FrankLove
Copy link

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
Copy link

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
Copy link
Author

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
Copy link

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

@ajitjati
Copy link

ajitjati commented Feb 5, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants