2

I've implemented a pull to refresh in my app. I think it is right:

swipeLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_container);
        swipeLayout.setOnRefreshListener(this);
        swipeLayout.animate();
        swipeLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
                android.R.color.holo_green_light,
                android.R.color.holo_orange_light,
                android.R.color.holo_red_light);

 public void onRefresh() {

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                swipeLayout.setRefreshing(false);
            }
        }, 5000);
    }


    boolean canChildScrollUp()
    {
        return resultado.getFirstVisiblePosition()!=0;
    }

No errors and I think it's working fine. The problem is that I want to put an overscroll on the listview, not the message "Swipe to refresh", just the overscroll and I don't know how to implement it.

Bojan Kseneman
  • 14,663
  • 2
  • 50
  • 58
user1423168
  • 145
  • 1
  • 1
  • 12
  • 1
    Look here may be this will help you - http://stackoverflow.com/questions/4583484/how-to-implement-android-pull-to-refresh – Josef Apr 18 '15 at 21:29
  • Thanks, actually my code works and refresh the content of the view, however, the thing that isn't in google documentation is the overscroll in the listview. Apps like Twitter or Facebook do that. – user1423168 Apr 18 '15 at 21:48
  • Can you post an image of that overscroll you are talking about for more details ? – Josef Apr 18 '15 at 22:05
  • Of course. I don't know how to attach an image here, I let you the link: http://cyrilmottier.com/media/2012/03/the-pull-to-refresh-an-anti-ui-pattern-on-android/pull_to_refresh.jpg I mean the "white" space between the bar and the layout with the text, the space that says="Pull to refresh"... – user1423168 Apr 18 '15 at 22:09
  • 1
    I dont know how to that, but in listView you can add header to it an there put what you want and while the listView scrolling down you can change the layout to another. – Josef Apr 18 '15 at 22:20
  • 1
    Simple search on google gave the following links : [this](https://github.com/Larphoid/android-Overscroll-ListView), [this](http://stackoverflow.com/questions/7803195/how-to-use-overscro) & [this](http://stackoverflow.com/questions/19334323/how-to-detect-overscroll-in-android) & [this](http://stackoverflow.com/questions/7423912/listview-overscroll) – Josef Apr 18 '15 at 22:34
  • Thank you. I'll try some of this and let see – user1423168 Apr 19 '15 at 08:02

0 Answers0