【问题标题】:how do i perform load data on swipe from top as well as bottom in ListView如何在 ListView 中从顶部和底部滑动时执行加载数据
【发布时间】:2015-05-21 11:47:44
【问题描述】:

我想在顶部滑动时加载旧数据,在底部滑动时加载新数据。如何执行此功能?请帮我执行此操作。

【问题讨论】:

标签: android listview scroll


【解决方案1】:

有大量的库可用于拉动刷新内容。

例如看看这里,https://github.com/OrangeGangsters/SwipyRefreshLayout

要实现您的目标,只需检测用户何时拉下屏幕并将一些数据返回到您的屏幕。看看如何,

mSwipyRefreshLayout.setOnRefreshListener(new SwipyRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh(SwipyRefreshLayoutDirection direction) {
                Log.d("MainActivity", "Refresh triggered at "
                    + (direction == SwipyRefreshLayoutDirection.TOP ? "top" : "bottom"));
            }
}); 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-14
    • 1970-01-01
    • 2020-04-27
    • 2020-10-10
    • 2016-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多