简体   繁体   English

如何检测滚动视图何时到达底部,以便可以向其中加载更多项目?

[英]How can I detect when a scrollview has reached the bottom so that I can load more items into it?

I have a scrollview in my android application that I fill with Items from a database. 我在android应用程序中有一个scrollview,我用数据库中的Items填充了它。 I start off with 20 items in it, but what I want to happen is for the scrollview to load more items when the user pulls the scrollview up when it is at the bottom. 我开始时有20个项目,但是我想发生的是,当用户在底部滚动视图时将其向上拉时,scrollview会加载更多项目。 I could override onDetectOverflow if it weren't private but I cannot so I can't figure out how to detect when the user is pulling the scrollview up. 如果onDetectOverflow不是私有的,我可以覆盖它,但是我不能这样做,所以我不知道如何检测用户何时向上拖动scrollview。 There doesnt seem to be any onScroll Listener I can use so does anyone have a way I can detect this? 我似乎没有可以使用的任何onScroll Listener,所以有人可以检测到吗?

You can use PullToRefresh listview for your requirement. 您可以根据需要使用PullToRefresh列表视图。 It will load data for both scrollview up and scrollview down according to the user scrolling.. The following link provides the source of PullToRefresh listview 它将根据用户滚动加载向上滚动视图和向下滚动视图的数据。以下链接提供了PullToRefresh listview的源

PullToRefresh PullToRefresh

AndroidPullToRefresh AndroidPullToRefresh

PullToRefresh-ListView PullToRefresh-的ListView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android - 我怎么知道gridview何时到达底部? - Android - how can i know when gridview has reached the bottom? 如何检测到Horizo​​ntalScrollView在Android中已结束? - How can I detect that the HorizontalScrollView has reached an end in Android? 当列表视图已到达顶部时,如何检测用户是否在向上滚动 - How can I detect if the user is scrolling up when the listview has already reached the top 检测scrollview是否到达底部钛 - detect if scrollview has reached the bottom titanium 在列表视图中向下滚动时如何加载更多项目? - How can I load more items when scrolling down in listview? 在 recyclerview kotlin 中加载更多内容时如何不重写项目? - how can I No Rewrite items when load more in recyclerview kotlin? 如何检测ScrollView正在滚动 - How can I detect ScrollView is scrolling Android - 在网格视图到达结束时加载更多项目 - Android - load more items when grid view has reached the end 如何检测滚动条何时到达网页的顶部或底部? - How to detect when the scrollbar has reached the top or bottom of webpage? 如何检查网格视图是否到达屏幕底部? 我想在到达最低点时显示更多照片 - How to check for grid View reached bottom of screen?? i want to show more pics when it reaches bottom
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM