0

If the ScrollView is scrolled down it has to show the footer. If its scrolled up, then footer has to disable. how to do this kinda stuff?

DroidLearner
  • 2,115
  • 5
  • 31
  • 50

1 Answers1

0

Somebody posted this in the comment already but here it is anyway.

@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        View view = (View) getChildAt(getChildCount()-1);
        int diff = (view.getBottom()-(getHeight()+getScrollY()));
        if( diff <= 0 ){ 
            yourFooter.setVisibility(View.GONE);
        }
        else{
            yourFooter.setVisibility(View.VISIBLE);
        }
        super.onScrollChanged(l, t, oldl, oldt);
}

Extend ScrollView and then override the onScrollChanged method.

Edward van Raak
  • 4,841
  • 3
  • 24
  • 38