Idan
Idan

Reputation: 2869

Android pull to refresh with ScrollView control

I am using a ScrollView to display a list of items that are inflated on runtime. Like a feed of updates for the user. While thinking about the options i got to let the user update the view with new notifications I thought about the pull to refresh feature in the twitter app.

Anyone got any idea how and if can it be implemented with a ScrollView ?

Saw there are some implementations for that using ListView but I don't like the idea of changing all of my platform to gain this refresh effect.

Upvotes: 3

Views: 6419

Answers (3)

Anand Tiwari
Anand Tiwari

Reputation: 1598

There is a solution introduced for implementing pull to refresh for various component which are scrollable like listview and scroollview. Look at ChangeLog link https://github.com/chrisbanes/Android-PullToRefresh

Upvotes: 1

weakwire
weakwire

Reputation: 9300

You can do that. You can increase the top margin of the scrollview when the user moves the finger down and the scrollview it's on it's top. Then on release fire the update and decrease the margin with animation.(You have to create your own animation to pull that off). That's the idea. If you want more particular help ask what you cannot implement.

Upvotes: 0

500865
500865

Reputation: 7120

ListView with just one element can be treated as a ScrollView. You can use the implementation for pull-to-refresh ListView and add just one item in it. I had used this trick in the past.

Upvotes: 0

Related Questions