Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Remove only bottom FadingEdge effect from scroll bar

I know how to disable fadingedge from scrollbar but what I need is to disable just the bottom fading edge without disabling the top fading edge effect, is that possible?

like image 300
Firas Avatar asked Nov 10 '14 10:11

Firas


1 Answers

You can achieve the effect you want by extending the ScrollView and overriding one of those two methods:

float getTopFadingEdgeStrength()
float getBottomFadingEdgeStrength()

They'll alow you to change the size of the fading edge - just set bottom value to 0 and you are ready to go :)

Code example with bottom fading turned off:

/**
 * Created by scana on 14.12.14.
 */
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;
    }
}
like image 131
scana Avatar answered Sep 29 '22 12:09

scana