2016-09-23 99 views
0

线:是否可以将两条线作为一条线来处理?

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绘制第二条线上面的第一线,作为一种解决方法我想知道是否可以处理这两个线条为一体。我有什么选择来实现这种输出?

+6

你的“预期输出”是把句子混杂在一起变成毫无意义的混杂吗? –

+0

预期看起来不正确。 – Enzokie

+1

是的,它是...:D但是确切地说,我总是希望第一行和第二行中的相同单词处于相同的位置,如'this'到'this'和'long'到'long'。 – amanda014

回答

1

“逻辑”解决方案是用空格替换第一个换行符\n

但在你的情况,似乎你想要一个水平滚动文本视图:

<TextView 
    android:lines="2" 
    android:scrollHorizontally="true" 
    android:singleLine="true" ... /> 

我不知道有关linessingleLine属性。