30

I just came to know about using ellipsize in a Text View. But I cannot understand what difference in effect am I supposed to get if I set android:ellipsize="marquee" rather than using android:ellipsize="end".I am new to android. Please help.

Syamantak Basu
  • 905
  • 4
  • 10
  • 20

3 Answers3

49

words that are longer than the view is wide to be ellipsized instead of broken in the middle. You will often also want to set scrollHorizontally or singleLine as well so that the text as a whole is also constrained to a single line instead of still allowed to be broken onto multiple lines.

Must be one of the following constant values.

Suppose original value text view is aaabbbccc and its fitting inside the view

Constant    Value   Description
none         0      
start        1      output will be : ...bccc
middle       2      output will be : aa...cc
end          3      output will be : aaab...
marquee      4      out put will be : aaabbbccc auto sliding from right to left
Vijay Vankhede
  • 3,018
  • 1
  • 26
  • 46
  • 10
    Good answer, but perhaps also worth mentioning that in case the input is "a abbbccc", i.e., multiple words, using ellipsize="end" will render the output "a...", not "a ab...". In other words, it will prefer replacing an entire word with "..." over breaking mid-word even if there is plenty of room for part of the word. – JHH Nov 04 '15 at 13:19
43

If you want to make your textview to scroll horizontally then ellipsize "marquee" will only work. Ellipsize "end" will help you to make your textview ellipsize with "..."

Sankar
  • 1,685
  • 2
  • 16
  • 27
20

If you want a horizontal scrollable text in your app, use

android:ellipsize="marquee"

where a single line large text will be scrolling.

But in case if you use,

android:ellipsize="end"

text after the end of screen will be shown as

...

Akanksha Hegde
  • 1,738
  • 11
  • 14