本文介绍了拉刷新,如Gmail新(4.5)的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在新的Gmail应用程序(4.5)刷新通过在动作条上拉来刷新操作完成的:

In the new gmail application (4.5) the refresh is done by "Pull-to-Refresh" action in the Actionbar:

在哪里可以找到更多的信息拉来刷新?

Where can I find more information about that "Pull-to-Refresh"?

推荐答案

克里斯·巴内斯(即实现最佳的拉刷新组件为Android一样的家伙)也实施了类似的GMail拉来刷新。

Chris Banes (the same guy that implemented the best pull to refresh component for android) also implemented the GMail like Pull To Refresh.

您可以在这里找到: https://github.com/chrisbanes/ActionBar-PullToRefresh

请注意,此项目仍在发展,使目前的API可能会发生改变。

Note that this project is still under development so the current API may change.

更新:

pcated两个动作条-PullToRefresh Android的PullToRefresh 是德$ P $。非标准的方式来实现拉动是使用 SwipeRefreshLayout V4支持库进行刷新。

Both ActionBar-PullToRefresh and Android-PullToRefresh are deprecated. Standart way to implement a pull to refresh is using SwipeRefreshLayout of v4 support library.

下面是所需的步骤:

  • 创建根或子布局SwipeRefreshLayout,把一个可滚动的项目在里面。

  • Create a root or sub layout with SwipeRefreshLayout and put a scrollable item in it.

<android.support.v4.widget.SwipeRefreshLayout
    ...>

<ListView
    .... />

</android.support.v4.widget.SwipeRefreshLayout>

  • 添加一个刷新监听器

  • Add a refresh listener

    SwipeRefreshLayout srl = ...;
    srl.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                ...
            }
        });
    

  • 您可以找到一个很好的教程吧如下:

    You can find a nice tutorial about it below:

    SwipeRefreshLayout:如何使用

    这篇关于拉刷新,如Gmail新(4.5)的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    07-25 19:29