How to make TextView with fading edge?

android 6.0.1

This code works

android:ellipsize="marquee"
android:marqueeRepeatLimit="0"
android:singleLine="true"

and don't forget

textView.setSelected(true);

In my case, @Эвансгелист Evansgelist's answer worked perfectly, although the fading was a little too subtle (for that particular project).

In the end, I had to add android:singleLine="true" to @gus27's answer to make it work and get the effect I wanted:

android:requiresFadingEdge="horizontal"
android:fadingEdgeLength="40dp"
android:ellipsize="none"
android:singleLine="true"

According to https://developer.android.com/reference/android/R.attr.html#fadingEdge android:fadingEdge is deprecated.

It should work with requiresFadingEdge="horizontal" and android:ellipsize="none" :

android:requiresFadingEdge="horizontal"
android:fadingEdgeLength="40dp"
android:ellipsize="none"

And I would recommend to use something like android:layout_width="match_parent" or android:layout_width="100dp" if you like the text to be faded.