KimHafr
KimHafr

Reputation: 2964

Android TextView

I have an Android TextView where the view itself is limited to four lines. If the text exceeds this limit I want the end of the view to end with something like .. <-- to notify that there is more text here so you can click and open in fullscreen for example. Not just suddenly stop in the middle of a sentence. Is there a quick fix for this?

Upvotes: 5

Views: 1955

Answers (3)

user8716106
user8716106

Reputation:

android:maxLines="4"
android:ellipsize="end"

Upvotes: 0

WBis
WBis

Reputation: 49

Go to the layout file which contains this textview and place following attribute

android:ellipsize="end"

There are 4 options. start, end, middle or marquee. Since you want dots at the end use "end" value

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1006744

Use the android:ellipsize="end" attribute in your layout XML file. It may still stop in the middle of a sentence, but it will have an ellipsis (...) at the end.

Upvotes: 3

Related Questions