【问题标题】:https://github.com/chrisbanes/ActionBar-PullToRefresh pull from serverhttps://github.com/chrisbanes/ActionBar-PullToRefresh 从服务器拉取
【发布时间】:2014-03-29 16:58:27
【问题描述】:

我正在尝试使用https://github.com/chrisbanes/ActionBar-PullToRefresh 来实现pull-to-refresh。但是我看不到示例中从我的服务器获取数据的位置。我正在使用观察者模式,以便在 update 方法中可以调用

mPullToRefresh.setRefreshComplete();

但是我在哪里调用服务器呢?

通过观察者模式,我的意思是有一个类 SynchDogs 负责从服务器拉取。然后这个 Listview 活动向 SynchDogs 注册为观察者。那么,在 Pull-to-refresh 模式中我告诉 SynchDogs 与服务器同步的地方是什么?我正在使用快速指南作为

private void setupPullToRefresh() {
    ActionBarPullToRefresh.from(this)
        .theseChildrenArePullable(R.id.dog_list)
        .listener(this)
        .setup(mPullToRefresh);
}

【问题讨论】:

    标签: android android-layout pull-to-refresh


    【解决方案1】:

    您从 pull-to-refresh 侦听器开始,然后在您的工作完成后通过 setRefreshComplete 停止

    PS:最好不要再使用这个库了https://plus.google.com/103829716466878605055/posts/8wmKAXEGAG2 现在官方库中有一个 SwipeRefreshLayout

    【讨论】:

    • 感谢 +1 链接。即使在单击 Add Support Library 并选择版本 19 后,eclipse 仍然无法找到 android.support.v4.widget.SwipeRefreshLayout 的活动。你知道怎么获得吗?
    • 你知道我怎么可能得到它吗?根据Android SDK Manager,我已经安装了两者。所以我不知道如何将它纳入我的项目。
    • 感谢您的链接,我找到了库。但我不是在寻找有关如何使用它的示例。我还找不到一个。我会问一个不同的问题并在此处链接。
    • 这是我的新问题的链接。你能帮我吗? stackoverflow.com/questions/22738522/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-16
    • 1970-01-01
    • 1970-01-01
    • 2013-11-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多