Reputation: 3370
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
Reputation: 1
Add following attribute in textview
android:ellipsize="end"
maxLines="2"
Upvotes: 0
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