making the edge of the scrollview fade when scrolling in android

this is for horizontal:

<HorizontalScrollView
    android:id="@+id/scroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:requiresFadingEdge="horizontal"
    android:fadingEdgeLength="80dp">

Here is what worked for me:

<ScrollView
    android:requiresFadingEdge="vertical"
    android:fadingEdgeLength="150dp">

Or instead in your code, you could do the following:

ScrollView scroll = findById(...);
scroll.setVerticalFadingEdgeEnabled(true);
// Or `scroll.setHorizontalFadingEdgeEnabled(true)`.
scroll.setFadingEdgeLength(150);