views:

44

answers:

1

Hello,

i have created a textview with the below code:

<TextView 
    android:id="@+id/txtDescription" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:textSize="16dip"
    android:textStyle="bold"
    android:maxLines="5">

As above, i have set the 5 Lines as maximum for the textview.

But my doubt is: if the string which i am going to display in Textview if it exceeds 5 lines, then it will be fitted upto 5 lines ending with "..." characters.

e.g.

Hello this is the demo of 
string which i have 
created especially for
the demo of textview
and setting maximum...

As same as above, i want to display in TextView output.

Pls give me suggestion, code or any link.

Thanx

+1  A: 

Just use android:ellipsize.

kcoppock
@Kcoppock exact solution that i wants, but let me know, when i use android:ellipsize attribute, at that time should i remove or keep the attribute android:maxLines="5" as same ?
PM - Paresh Mayani
@kcoppock see what happens now when i use android:ellipsize, if i am having string in 2 paragraph, then each paragraphs first 2 lines are displayed and then ellipsized at end.
PM - Paresh Mayani
Hmm, playing around with it now, even with maxLines on, it still ellipses it at 2 lines. I'm not sure why that is.
kcoppock
@kcoppock ya exactly ellipses it at 2 lines even with maxLines on
PM - Paresh Mayani
Does the same even with android:lines or android:minLines as well. Strange. :( I'm not really sure why that is; the only time I've ever used it was for a single line.
kcoppock
It's a known Android bug
fedj
So I wonder, would it be possible to extend TextView and just override the setEllipsize() function and fix the issue manually?
kcoppock