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.
3 Answers
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

- 3,018
- 1
- 26
- 46
-
10Good 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
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 "..."

- 1,685
- 2
- 16
- 27
-
Also you should call TextView.isSelected = true method to auto scroll with ellipsize "marquee" attribute. – toffor Nov 13 '19 at 16:59
-
@toffor Can you please explain why they did it this way? And if it's possible to do it right in XML instead of XML+code? – android developer Jul 03 '23 at 13:12
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
...

- 1,738
- 11
- 14