Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android (list)view overscroll like Sense UI

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

like image 728
Fabian Avatar asked Aug 12 '11 15:08

Fabian


4 Answers

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.

like image 96
Jozua Avatar answered Nov 17 '22 01:11

Jozua


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.

like image 31
Ted Hopp Avatar answered Nov 17 '22 00:11

Ted Hopp


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.

like image 1
sky wing Avatar answered Nov 17 '22 00:11

sky wing


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'
}
like image 1
d4vidi Avatar answered Nov 16 '22 23:11

d4vidi