[英]Android TextView not wrapping it's text correctly
As you can see from the image below, Android does not wrap my text as I would expect: 正如您从下图所示,Android不会像我期望的那样包装我的文本:
There is no space between the "-" and the "$", yet they are on different lines. “ - ”和“$”之间没有空格,但它们位于不同的行。 The string is just defined like this:
该字符串就像这样定义:
<string name="hello_world">Hello stackoverflow. This text does not wrap well -$999,999,999.</string>
Is there any way to change this behaviour? 有没有办法改变这种行为? I want "-$999,999,999" to wrap as if it were one word.
我希望“ - $ 999,999,999”包装好像是一个单词。
If I understood it correctly it is more a matter of text-formatting. 如果我理解正确,则更多的是文本格式化问题。 If you want "-" and "$" to be on the same row, set the text as textView.setText("Hello stackoverflow. This text does not wrap well \\n -$999,999,999.").
如果您希望“ - ”和“$”位于同一行,请将文本设置为textView.setText(“Hello stackoverflow。此文本不能很好地包装\\ n - $ 999,999,999。”)。 The "\\n" is interpreted as a new line
“\\ n”被解释为新行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.