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

1

33

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

enter image description here

enter image description here

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

Concentre answered 7/6, 2013 at 2:56 Comment(4)
#4583984Interpolate
This link regarding the old way to do that... (2 years post). It's look like gmail does it in a new way.Concentre
Rather than a real "pull to refresh" it appears to be a simple gesture detector that is detecting a downward swipe.Cakewalk
For someone with the same question: tutecentral.com/android-pull-to-refreshBiconvex
C
55

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

Colas answered 7/6, 2013 at 2:57 Comment(5)
This project is no longer maintained, be aware.Barcellona
github.com/chrisbanes/ActionBar-PullToRefresh looks still maintained (last commit sept 24). Did you mean Android-PullToRefresh? Because his docs do say that old project is no longer maintained.Kaden
Also, this tutorial on ActionBar-PullToRefresh might be helpful: tutecentral.com/android-pull-to-refreshMehalick
developer.android.com/reference/android/support/v4/widget/…Tectonic
Thank you Chiara! Funny how googling "Android pull to refresh" doesn't show that pageKrug

© 2022 - 2024 — McMap. All rights reserved.