I'm building an app that loads images from JSON and displays them as grid view.
the problem is that there are hundreds of images and i want to load 20 each time,
I want to download more pictures from the server when the scroll reaches the bottom.
so, how can i tell when the grid view reaches the bottom?
I've searched the web and couldn't figure this one...
anyone have ideas?
I'm adding a photo of an app that does something very similar to what i want. thanks.
And here is my solution, You may want to simply override the onOverScrolled
method :
@Override
protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
super.onOverScrolled(scrollX, scrollY, clampedX, clampedY);
View view = (View) getChildAt(getChildCount()-1);
int diff = (view.getBottom()-(getHeight()+getScrollY()));
if(diff==0) {
//overscroll on bottom
} else {
//overscroll on top
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With