6

I have a scrollable textview that I want to fade the bottom edge. I tried:

android:requiredFadingEdge="vertical"

but that only fades the top. How do I fade the bottom instead of the top?

Jonik
  • 80,077
  • 70
  • 264
  • 372
DANGERZONE94
  • 139
  • 1
  • 9
  • Possible duplicate of [Fading at the bottom of a scrollable list on Android?](http://stackoverflow.com/questions/12535280/fading-at-the-bottom-of-a-scrollable-list-on-android) – buczek Apr 18 '16 at 21:25
  • That question doesn't answer my problem – DANGERZONE94 Apr 18 '16 at 21:27
  • Actually, I've already asked this question. But no one can answer it. http://stackoverflow.com/questions/35910548/fading-bottom-of-scrollable-textview – hehe Apr 19 '16 at 02:57
  • I found a solution by extending TextView and overriding onDraw with a LinearGradient, similar to what is done here: https://github.com/maheswaranapk/Android-Fade-EditText-View/blob/master/fade-edit-text/src/main/java/com/fadeedittext/FadeEditText.java – DANGERZONE94 Apr 19 '16 at 17:49

1 Answers1

5

If your scrollable TextView happens to be implemented by wrapping it in a ScrollView, then quite simply add android:requiresFadingEdge and android:fadingEdgeLength for the ScrollView.

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:requiresFadingEdge="vertical"
    android:fadingEdgeLength="@dimen/spacing_small">    

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical" />

</ScrollView>
Jonik
  • 80,077
  • 70
  • 264
  • 372