Thursday, April 11, 2013

[android help] Android pull to refresh with ScrollView control

Android pull to refresh with ScrollView control - Stack Overflow




















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.





























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


























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.






















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.




















default







.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...