views:

161

answers:

1
+1  Q: 

Android TextView

Hi!

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?

+2  A: 

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.

CommonsWare
Hi! Thanks! Only problem now is that the text ends after two lines no matter what. Have set android:maxLines="4". Any idea? Goes up to four lines without the code you gave.
KimAMartinsen
Hmmmm...based on the documentation, it looks like `android:ellipsize` may be designed for a single line, not multiple lines. I do not know why you are getting two lines of output instead of 1 or 4, though. Do you have `android:minLines` or `android:minHeight` defined?
CommonsWare
No, only maxLines is set. Tried both commands you gave, but still only two lines. Tricky this one..
KimAMartinsen