2016-09-23 8 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. 

은 두 치료 가능한 경우 궁금 대안으로, 제 2 라인을 상기 제 선을 그릴 ReplacementSpan를 사용 게다가 줄을 하나로. 그러한 출력을 얻기 위해서는 어떤 옵션이 필요합니까?

+6

귀하의 "예상 결과"는 문장을 함께 사용하여 의미없는 mish-mash로 만드는 것입니까? –

+0

예상이 옳지 않은 것 같습니다. – Enzokie

+1

그래, 그게 ... : D하지만 정확히 말하자면, 항상 첫 번째와 두 번째 줄에서 'this'와 'this'와 'long'~ 'long'과 같은 위치에 있어야한다. – amanda014

답변

1

"논리적 인"해결책은 첫 번째 줄 바꿈 \n을 공백으로 대체하는 것입니다.

그러나 귀하의 경우에 당신은 수평으로 스크롤 텍스트보기를 원하는 것 같다

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

나는 linessingleLine 속성에 대해 확실하지 오전.

관련 문제