For instance:
This is foo text for wrapping text in TextView
The way that TextView wraps is:
This is foo text for
wrapping text in ...
I want this:
This is foo text for wr
apping text in TextView
Please goto "File->Settings->Editor->General" tab and check "Use soft wraps in editor". it will solve your problem.
Select Format and then under Arrange, select Wrap Text. Choose the wrapping option that you want to apply. Tip: To change a picture or drawing object's position on the page relative to the text, select the picture or object, select Format > Position, and then select the position that you want.
"Wrapping text" means displaying the cell contents on multiple lines, rather than one long line. This will allow you to avoid the "truncated column" effect, make the text easier to read and better fit for printing.
It's a bit hacky, but you could replace spaces with the unicode no-break space character (U+00A0). This will cause your text to be treated as a single string and wrap on characters instead of words.
myString.replace(" ", "\u00A0");
As I know, there is no such property for TextView. If you want to implement text wrapping by yourself, you can override TextView and use Paint's breakText(String text, boolean measureForwards, float maxWidth, float[] measuredWidth)
function. Note that you have to specify text size, typeface etc to Paint instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With