How to make Android ScrollView fading edge always visible?

Viewed 11919

By default scrollview's fading edge is visible only if it is possible to scroll in that direction. How can I make it visible at all times?

I don't want to put any drawables on top or something like that. I want to accomplish it using the builtin fading edge, probably by overriding some scrollview functions.

2 Answers

You can also use the following code:

public class TopFadeEdgeScrollView extends ScrollView {

public TopFadeEdgeScrollView(Context context) {
    super(context);
}

public TopFadeEdgeScrollView(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public TopFadeEdgeScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
}

@Override
protected float getBottomFadingEdgeStrength() {
    return 0.0f;
}
}
Related