Chintan Raghwani
Chintan Raghwani

Reputation: 3370

How to put an ellipsis at the end of TextView containing two lines

I have a TextView in Android and I want to put an ellipsis (". . .") at the end of the TextView when there are more characters in the text than the size of the TextView (i.e. when the entire text cannot be displayed in the TextView).

I know the solution when there is one line in the TextView:

singleLine="true" and maxLines="1"

However, I have two lines in my TextView.

Upvotes: 1

Views: 5065

Answers (3)

rupam patil
rupam patil

Reputation: 1

Add following attribute in textview

android:ellipsize="end"
maxLines="2"

Upvotes: 0

edthethird
edthethird

Reputation: 6263

there is a setEllipsize method on the textview,

which takes a parameter of:

TextUtils.TruncateAt END

TextUtils.TruncateAt MARQUEE

TextUtils.TruncateAt MIDDLE

TextUtils.TruncateAt START

Upvotes: 1

Samir Mangroliya
Samir Mangroliya

Reputation: 40416

 android:ellipsize="end" for ...end of text

Upvotes: 7

Related Questions