Pull to refresh like gmail new (4.5) application [closed]

柔情痞子 提交于 2019-12-03 06:22:55

问题


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"?


回答1:


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

You can find it here: https://github.com/chrisbanes/ActionBar-PullToRefresh

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

Update:

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

Here is the required steps:

  • 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: How to use



来源:https://stackoverflow.com/questions/16975544/pull-to-refresh-like-gmail-new-4-5-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!