Android的:如何通过字符文本换行? (不通过的话) [英] Android: How to wrap text by chars? (Not by words)
本文介绍了Android的:如何通过字符文本换行? (不通过的话)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:
这是富文本中的TextView文本换行
这TextView的包的方法是:
这是富文本
文本换行的...
我想这样的:
这是富文本WR
在TextView中apping文本
解决方案
这是一个有点哈克,但你可以用C无间断空格字符(U + 00A0)单向$ C $替代空间。这将导致你的文本被视为一个字符串和包装上的字符,而不是单词。
myString.replace(,\ u00A0);
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
解决方案
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");
这篇关于Android的:如何通过字符文本换行? (不通过的话)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文