Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace ellipses with fade / fading edge in textview in Android sdk?

I have a list, each row in the list has text. Some of the text extends beyond the edge of the screen. I have no problem making it truncate the text and show ellipses. I have no problem to 'fade the edge of the text' however, the fade occurs at the edge of every text, not just the ones the are too large for the textview.

I have searched and searched and can't find a way to, essentially, do exactly what the ellipses do, but, instead of ellipses, fade the edge of the text only if it is going off the edge of the screen. Can anyone please help? Right now, my text view contains:

android:fadingEdge="horizontal" 
android:inputType="text"
android:maxLines="1"

I have tried many other things to no avail.

like image 851
2 revs Avatar asked Sep 20 '11 17:09

2 revs


1 Answers

To enable marquee and simulateouly not affecting the list Selections Just use following:

In the code just use two methods on that text View.

textViewObj.setSelected(true);
textViewObj.setEllipsize(TextUtils.TruncateAt.MARQUEE);
like image 117
Arpit Garg Avatar answered Sep 19 '22 05:09

Arpit Garg