2011-06-14 4 views
2

가능한 중복으로 추가 :
android - line break in TextView만 2 개 라인을 보여

<TextView 
    android:text="Weeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee." 

    android:id="@+id/txtDesc" 
    android:maxLines="3" 
    android:lines="3" 
    android:ellipsize="end" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"/> 

는이 같은 시도했지만이 만 1 라인을 보여 ... 끝에

2 줄을 표시하도록 설정하는 방법 ...

사용하는 경우 android:ellipsize="marquee" instread it won't show ... at the end and show only 1 line

+0

는 여기를 참조하십시오 http://stackoverflow.com/questions/5382490/android-line-break-in-textview/5384545#5384545 – John

+0

I 시도 모두 제안했지만 여전히 작동하지 않습니다 – user790156

+0

android : lines = "2"android : maxLines = "3" –

답변

6

두 개의 TextView을 사용할 수 있습니다. 하나의 TextView에서 텍스트 부분을 보여주고 두 번째 부분에서는 TextView을 사용하십시오. 저는 타원형이 한 줄에 데이터를 표시 할 것이고 그 후에는 타원으로 표시 될 것이라고 생각합니다. 타원형을 사용하는 경우 TextView에 두 줄의 데이터를 얻을 수 있습니다. 그래서 내가 두 개의 TextView을 사용하도록 제안한 이유가 있습니다. 마지막 TextView 사용 타원에서

<TextView 
    android:text="Weeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee are one of the UK�s leading retailers, with over 21 million people visiting our stores each week. We offer stylish, high quality, great value clothing and home products, as well as outstanding quality foods, responsibly sourced from around 2,000 suppliers globally. We employ over 75,000 people in the UK and abroad, and have over 600 UK stores, plus an expanding international business. We are the number one provider of womenswear and lingerie in the UK, and are rapidly growing our market share in menswear, kidswear and home, due in part to our growing online business. Overall, our clothing and homeware sales account for 49% of our business. The other 51% of our business is in food, where we sell everything from fresh produce and groceries, to partly-prepared meals and ready meals. Now more than ever, we�re also known for our green credentials as a result of our five-year eco plan, Plan A, which will see us, amongst other things, become carbon neutral and send no waste to landfill by 2012." 
    android:id="@+id/txtDesc" 
    android:maxLines="3" 
    android:lines="3" 
    android:ellipsize="end" 
    android:layout_width="100dip" 
    android:layout_height="wrap_content"/> 

감사 디팍