行:
This is the first line and it is long line1.
This is the second line and it is long line2.
显然,这两行包含" \ n"最后。
但是当设备屏幕很小时,在某些时候。
默认输出:
This is the first line and
it is long line1.
This is the second line and
it is long line2.
预期产出:
This is the first line and
This is the second line and
it is long line1.
it is long line2.
除了使用ReplacementSpan在第二行之上绘制第一行之外,作为一种解决方法,我想知道是否可以将这两行视为一行。我有什么选择来实现这样的输出?
答案 0 :(得分:1)
“逻辑”解决方案是用空格替换第一个换行符\n
。
但在您的情况下,您似乎想要一个水平滚动的文本视图:
<TextView
android:lines="2"
android:scrollHorizontally="true"
android:singleLine="true" ... />
我不确定lines
和singleLine
属性。