Search code examples
getrefreshtap

Get rid of "Tap to refresh" button with android-pulltorefresh


I've used this code https://github.com/johannilsson/android-pulltorefresh

It all works perfectly apart from one thing, when my ListView loads it always says "Tap to refresh" at the top, until I tap or drag then it vanishes and my ListView looks normal again. I really don't want it to initialise with "tap to refresh" its ugly, annoying and pointless seeing that dragging down will do exactly the same job and won't get in the way at all.

I've tried hacking the code to bits to see if I can do it - theoretically it should be very easy since it disappears when you touch it, but even grabbing the exact same code it calls when you touch it and explicitly calling that doesn't do it. I'm utterly confused, can anyone help me tweak the code so when I use this it doesn't have that annoying "tap to refresh" thing at the top of my list...


Solution

  • the way i did it was to add this to my code

      ListView list = getListView();
      list.scrollTo(0, 60);
    

    and then when its finished loading

     list.scrollTo(0, 0);
    

    what it does is scrolls the list view off the screen so you cant see the tap to refresh and then when its finished loading pulls everything back to the start point and the tap to refresh isn't visible

    jope that helps i couldn't find anything but this is my way round it