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?
Asked
Active
Viewed 622 times
0

DroidLearner
- 2,115
- 5
- 31
- 50
-
1show us what you already tried. – Emil Adz Mar 28 '13 at 10:24
-
Is that a scrollView or listView – Triode Mar 28 '13 at 10:24
-
1Maybe this link can help you: http://stackoverflow.com/questions/4953692/android-detecting-when-scrollview-hits-bottom When you get to the bottom you could show your bottom view – Gyonder Mar 28 '13 at 10:27
-
@EmilAdz I haven't tried. Just asking a suggestion so that I can implement – DroidLearner Mar 28 '13 at 10:31
-
@Gyonder checking it... – DroidLearner Mar 28 '13 at 10:31
1 Answers
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