-
Notifications
You must be signed in to change notification settings - Fork 156
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
AutoResizeTextView doesn't wrap content when has new line character in the string ('\n') #37
Comments
The idea is that the TextView will wrap the text automatically for you, so there is no use for "\n" , and therefore no need to check for it. |
I agree with overcomer, I am displaying content from a server that sometimes contains new line characters. I have modified the isValidWordWrap method as above. |
Also having a '\n' at the end of the string throws a StringIndexOutOfBoundsException. I updated the isValidWordWrap to remove the second unused parameter:
and the call to this method:
This seems to be working for me. |
You think I should add this fix? |
@tagy Can you please make a pull request? |
Hi, Sorry I have not been working on Android for a while. I will try to look at this again in a week or so and make a pull request. |
This issue is still exists in latest version also. can you have look on this. This works good even we may not check condition for if (i < lineCount - 1 && end > 0 && !isValidWordWrap(text.charAt(end - 1))) |
guys if you have found a nice working solution, please do a PR and I will use it. |
I use AutoResizeTextView and set the string in strings.xml such as "This is a string\nwith new line character". The string will displayed as a very small text.
I think the issue is in isValidWordWrap method, it doesn't include (before == '\n') as a valid word wrap. I have tested by adding (before == '\n') in isValidWordWrap method as following:
And it will work as expected.
The text was updated successfully, but these errors were encountered: