I've searched some time on google and on stackoverflow but i can't find a solution. Is there any posibility to get a listview overscroll on Android 2.2 or 2.1 like the sense ui does?! Like here in my alarm view: AlarmView Sense UI
I'm shocked to see Chirag's answer being highly rated like this. It isn't helpful to anyone because its incomplete and doesn't build. It also doesn't cite its source.
The original code is found here: http://code.google.com/p/scroll-pager/
Also note that the scroll-pager code is released under the GPL license.
UPDATE : I talked to the author of scroll-pager and he has now switched to the MIT license.
Listview has built-in support for overscrolling. Check out setOverscrollMode and related methods setOverscrollHeader and setOverscrollFooter. ListView makes use of the overscroll header/footer by overriding AbsListView.onOverscrolled; if you want different behavior, you can implement it by overriding it yourself.
http://developer.android.com/reference/android/widget/ScrollView.html
You should never use a ScrollView with a ListView, because ListView takes care of its own vertical scrolling. Most importantly, doing this defeats all of the important optimizations in ListView for dealing with large lists, since it effectively forces the ListView to display its entire list of items to fill up the infinite container supplied by ScrollView.
I can see this post is pretty old, but I've recently released this open-source project on GitHub which solves this problem and could help others solve similar over-scroll issues in the future.
It basically provides an iOS-like over-scrolling effect for many core Android scrollable views - ListView is one of them, and is very easy to apply.
Specifically for list-views, all you have to do to enable it this:
ListView listView = ... // For example: (ListView) findViewById(R.id.list_view);
OverScrollDecoratorHelper.setUpOverScroll(listView);
And to include the project in yours, add this to your build.gradle:
dependencies {
// ...
compile 'me.everything:overscroll-decor-android:1.0.0'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With