Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set long text only show 2 lines and append with [duplicate]

Possible Duplicate:
android - line break in TextView

<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"/>

I tried like this but it show only 1 line with ... at the end

how to set it to show 2 line with ...

if I use android:ellipsize="marquee" instread it won't show ... at the end and show only 1 line

like image 462
user790156 Avatar asked Jan 20 '23 12:01

user790156


1 Answers

You can use two TextView's. In one TextView show part of text and in the second TextView use the following code. I think ellipse will display data in one line and after that it ellipses. If you use ellipse i donot htink you can get two lines of data in TextView. Thats why I suggested you to use two TextView's. In the last TextView use ellipse

<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"/>

Thanks Deepak

like image 108
Sunil Kumar Sahoo Avatar answered Jan 22 '23 01:01

Sunil Kumar Sahoo